Skip to content

Instantly share code, notes, and snippets.

View BurlesonBrad's full-sized avatar
🎯
Focusing

Brad Griffin BurlesonBrad

🎯
Focusing
View GitHub Profile
@BurlesonBrad
BurlesonBrad / clayton.php
Last active December 31, 2015 16:57
Remove WooCommerce Sidebars ONLY on Product Pages
/* Clayton, you MUST add the code below to your CHILD THEME's functions.php file. */
/* This will remove the sidebar on the product page */
/* BEGIN No sidebar */
function clayton_has_no_more_sidebar() {
if( is_product() )
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
}
add_action( 'template_redirect', 'clayton_has_no_more_sidebar' );
/* End No sidebar */
@BurlesonBrad
BurlesonBrad / functions.php
Created December 28, 2015 04:42
For Darryn
/* Use a custom image for PayPal on WooCommerce checkout page. */
/* Be sure to change line 6 to point to your new image */
function my_new_paypal_icon() {
// picture of accepted credit card icons for PayPal payments
return get_stylesheet_directory_uri() . 'somefolder/images/your-new-image.jpg';
}
add_filter( 'woocommerce_paypal_icon', 'my_new_paypal_icon' );
@BurlesonBrad
BurlesonBrad / big-fux-bug-fix.php
Created December 13, 2015 22:08
lines 1931 - 1936 in Woo 2.5 beta
public function email_order_items_table( $args = array(), $deprecated1 = null, $deprecated2 = null, $deprecated3 = null, $deprecated4 = null, $deprecated5 = null ) {
ob_start();
if ( ! is_null( $deprecated1 ) || ! is_null( $deprecated2 ) || ! is_null( $deprecated3 ) || ! is_null( $deprecated4 ) || ! is_null( $deprecated5 ) ) {
_deprecated_argument( __FUNCTION__, '2.5.0' );
}
add_filter( 'woocommerce_add_cart_item_data', 'rodolpho_is_a_sexy_beast_empty_cart', 10, 3);
function rodolpho_is_a_sexy_beast_empty_cart( $cart_item_data, $product_id, $variation_id )
{
global $woocommerce;
if ( $product_id == 851 ) {
$woocommerce->cart->empty_cart();
}
return $cart_item_data;
}
@BurlesonBrad
BurlesonBrad / Cristina:Only show products from within the current category.
Created November 20, 2015 15:20
Cristina:Only show products from within the current category.
//Christina's function for showing ONLY related items in the SAME category//
// Christina, drop this into your CHILD functions.php file //
function get_related_custom( $id, $limit = 5 ) {
global $woocommerce;
$cats_array = array(0);
$terms = wp_get_post_terms($id, 'product_cat');
foreach ( $terms as $term ) $cats_array[] = $term->term_id;
<?php
// Add Variation Settings
add_action( 'woocommerce_product_after_variable_attributes', 'variation_settings_fields', 10, 3 );
// Save Variation Settings
add_action( 'woocommerce_save_product_variation', 'save_variation_settings_fields', 10, 2 );
/**
* Create new fields for variations
@BurlesonBrad
BurlesonBrad / add-to-cart-with-quantity.php
Created November 17, 2015 21:05
Add To Cart With Quantity
<?php
/**
* Loop Add to Cart
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
@BurlesonBrad
BurlesonBrad / wpfixit
Last active November 13, 2015 23:47
wpfixit
add_action( 'wp_dashboard_setup', 'register_my_dashboard_widget' );
function register_my_dashboard_widget() {
wp_add_dashboard_widget(
'my_dashboard_widget',
'WpFixIt Sales At A Glance',
'my_dashboard_widget_display'
);
}
@BurlesonBrad
BurlesonBrad / nick
Last active November 13, 2015 08:14
nick
// Begin Speed Tweaks //
function remove_cssjs_ver( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
@BurlesonBrad
BurlesonBrad / enhance.php
Created October 31, 2015 02:01
Enhancing Woo's StoreFront
<?php
/**
* Welcome screen enhance template
*/
?>
<?php
?>
<div class="col two-col" style="overflow: hidden;">
<div class="col">