Skip to content

Instantly share code, notes, and snippets.

Elvin Lee elvinlee

Block or report user

Report or block elvinlee

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@elvinlee
elvinlee / functions.php
Created Aug 21, 2015
Change the Order of Kiwi Logo Carousel
View functions.php
/**
* Default is ASC, change to DESC
**/
add_action( 'pre_get_posts', 'custom_kiwi_order' );
function custom_kiwi_order( $query ) {
if ( is_home() && $query->is_main_query() )
$query->set( 'post_type', 'kwlogos' );
$query->set( 'order' , 'desc' );
return $query;
}
@elvinlee
elvinlee / functions.php
Created Jul 29, 2015
WordPress: Add Post Type & Post Name to Body Class
View functions.php
/**
* Add Post Type & Post Name to Body Class
* For example: page-about-us
*/
add_filter('body_class', 'add_post_class');
function add_post_class($classes) {
global $post;
if ( isset( $post ) ) {
$classes[] = $post->post_type . '-' . $post->post_name;
}
@elvinlee
elvinlee / functions.php
Last active Aug 29, 2015
WC Vendors: Rename "Sold by" to Seller
View functions.php
/**
* Can change Seller to any name you want to change
*/
function rename_sold_by($text) {
$return = str_replace('Sold by', 'Seller', $text);
return $return;
}
add_filter('wcvendors_sold_by_in_loop', 'rename_sold_by'); // Product Loop
add_filter('wcvendors_cart_sold_by', 'rename_sold_by'); // Cart Page
add_filter('wcvendors_cart_sold_by_meta', 'rename_sold_by'); // Single Product Page
@elvinlee
elvinlee / functions.php
Last active Jan 19, 2016
WooCommerce: Remove Sidebar from all WooCommerce Page
View functions.php
//WooCommerce Remove Sidebar
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
@elvinlee
elvinlee / functions.php
Last active Aug 29, 2015
WooCommerce: Disable BACS if Customer Checkout Country Out of Singapore
View functions.php
add_filter( 'woocommerce_available_payment_gateways', 'bacs_disable_outside_singapore' );
//Disable bacs if the country not in Singapore
function bacs_disable_outside_singapore( $available_gateways ) {
global $woocommerce;
if ( isset( $available_gateways['bacs'] ) && $woocommerce->customer->get_country() <> 'SG' ) {
unset( $available_gateways['bacs'] );
}
return $available_gateways;
}
You can’t perform that action at this time.