Skip to content

Instantly share code, notes, and snippets.

View Bradley-D's full-sized avatar
✌️

Bradley Davis Bradley-D

✌️
View GitHub Profile
/**
* Change the add to cart text on single product pages
*/
function woo_custom_cart_button_text() {
global $woocommerce;
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) {
$_product = $values['data'];
// unregister all widgets
function unregister_default_widgets() {
unregister_widget( 'WP_Widget_Pages' );
unregister_widget( 'WP_Widget_Calendar' );
unregister_widget( 'WP_Widget_Archives' );
unregister_widget( 'WP_Widget_Links' );
unregister_widget( 'WP_Widget_Meta' );
unregister_widget( 'WP_Widget_Search' );
unregister_widget( 'WP_Widget_Text' );
unregister_widget( 'WP_Widget_Categories' );
/**
** Rename name of Black Studio Tiny MCE
**/
function change_tinymce_widget_title( $translation, $text, $domain ) {
if ( $text == 'Black Studio TinyMCE' )
$translation = 'Text - Visual Editor';
return $translation;
}
add_filter( 'gettext', 'change_tinymce_widget_title', 10, 3 );
<?php
/* This snippet removes the action that inserts thumbnails to products in teh loop
* and re-adds the function customized with our wrapper in it.
* It applies to all archives with products.
*
* @original plugin: WooCommerce
* @author of snippet: Brian Krogsard
*/
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
// Add to functions.php
/*===================================================
Created by sk from Renegade Empire with help
from these sources:
http://docs.woothemes.com/document/editing-product-data-tabs/
http://www.sean-barton.co.uk/2013/03/remove-woocommerce-20-reviews-tab/#.UYnWe7XfB6N
http://www.sean-barton.co.uk/2013/03/sb-add-woocommerce-tabs-wordpress-plugin/#.UYrYL7XfB6M
// Add new image sizes
function bd_insert_custom_image_sizes( $image_sizes ) {
// get the custom image sizes
global $_wp_additional_image_sizes;
// if there are none, just return the built-in sizes
if ( empty( $_wp_additional_image_sizes ) )
return $image_sizes;
// add all the custom sizes to the built-in sizes
foreach ( $_wp_additional_image_sizes as $id => $data ) {
//Google Maps Shortcode - [googlemap]
function bd_google_maps( $atts, $content = null ) {
extract(shortcode_atts(array(
'width' => '', //set the width
'height' => '', // set the height
'src' => '' // get the src from google map embed
), $atts));
return '<iframe width="' . $width . '" height="' . $height . '" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="' . $src . '&amp;output=embed"></iframe>';
}
/* ------------------------------------------------------------------------ */
/* Add Menu to page with shortcode - [menu name="menu-name"]
/* ------------------------------------------------------------------------ */
function bd_menu_content_shortcode( $atts, $content = null ) {
extract( shortcode_atts(array( 'name' => null, ), $atts ) );
return wp_nav_menu( array( 'menu' => $name, 'echo' => false ) );
}
add_shortcode( 'menu', 'bd_menu_content_shortcode' );
// Line 87 of
// If item has_children add atts to a.
if ( $args->has_children && $depth === 0 ) {
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
$atts['class'] = 'dropdown-toggle';
//$atts['data-toggle'] = 'dropdown'; <- This line gets added in theme.js when window width is < 768
$atts['aria-haspopup'] = 'true';
} else {
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
}