Skip to content

Instantly share code, notes, and snippets.

View blogjunkie's full-sized avatar

David Wang blogjunkie

View GitHub Profile
@billerickson
billerickson / gist:1325966
Created October 30, 2011 14:36
Add Blog to Breadcrumbs
<?php
/**
* Add Blog to Breadcrumbs
* @author Bill Erickson
* @link http://www.billerickson.net/adding-blog-to-genesis-breadcrumbs/
*
* @param string original breadcrumb
* @return string modified breadcrumb
*/
function be_add_blog_crumb( $crumb, $args ) {
@mikejolley
mikejolley / gist:1622323
Created January 16, 2012 18:54
WooCommerce - Change default catalog sort order
/**
* This code should be added to functions.php of your theme
**/
add_filter('woocommerce_default_catalog_orderby', 'custom_default_catalog_orderby');
function custom_default_catalog_orderby() {
return 'date'; // Can also use title and price
}
@franz-josef-kaiser
franz-josef-kaiser / deprecated.md
Last active October 1, 2015 01:07
is_ssl() for most cases - mu-plugin

Deprecated

For a Replacement visit this project on our GitHub organisation account.

@mikejolley
mikejolley / gist:1926284
Last active June 8, 2020 17:24
WooCommerce - Change WooCommerce email subject lines
/*
* goes in theme functions.php or a custom plugin
*
* Subject filters:
* woocommerce_email_subject_new_order
* woocommerce_email_subject_customer_processing_order
* woocommerce_email_subject_customer_completed_order
* woocommerce_email_subject_customer_invoice
* woocommerce_email_subject_customer_note
* woocommerce_email_subject_low_stock
@thegdshop
thegdshop / gist:2141771
Created March 20, 2012 22:08
WooCommerce - Change add to cart button text
<?php
add_filter('single_add_to_cart_text', 'woo_custom_cart_button_text');
function woo_custom_cart_button_text() {
return __('My Button Text', 'woocommerce');
}
@ChromeOrange
ChromeOrange / functions-columns.php
Created June 28, 2012 14:00
Change the product columns in WooCommerce
/*
1 - modify your theme functions file
2 - modify the 'loop-shop.php' file
You need to set the 'Product List' value to suit your layout. You will also need to look at changing the CSS if you change from the default WooCommerce values.
1 : Add this to your theme functions file
*/
add_filter('loop_shop_columns', 'wc_product_columns_frontend');
function wc_product_columns_frontend() {
global $woocommerce;
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@kloon
kloon / functions.php
Created February 13, 2013 08:25
WooCommerce CC all emails
<?php
add_filter('woocommerce_email_headers', 'woo_cc_emails' );
function woo_cc_emails() {
return 'Bcc: youremail@yourdomain.com' . "\r\n";
}
?>
@jameskoster
jameskoster / functions.php
Last active October 5, 2020 17:34
WooCommerce - Remove product data tabs
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
function woo_remove_product_tabs( $tabs ) {
unset( $tabs['description'] ); // Remove the description tab
unset( $tabs['reviews'] ); // Remove the reviews tab
unset( $tabs['additional_information'] ); // Remove the additional information tab
return $tabs;
@coenjacobs
coenjacobs / wc-custom-product-order.php
Created June 18, 2013 09:32
Adds a custom way of ordering products, in this example it's 'random' product ordering. This can also be set to be used as default via the Catalog tab in WooCommerce settings.
<?php
add_filter( 'woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args' );
function custom_woocommerce_get_catalog_ordering_args( $args ) {
$orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
if ( 'random_list' == $orderby_value ) {
$args['orderby'] = 'rand';
$args['order'] = '';