This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// WooCommerce Code | |
// Show empty categories | |
// https://gist.github.com/renegadesk/3926139 | |
// https://gist.github.com/dalemoore | |
add_filter('woocommerce_product_subcategories_args', 'woocommerce_show_empty_categories'); | |
function woocommerce_show_empty_categories( $cat_args ){ | |
$cat_args[ 'hide_empty' ] = 0; | |
return $cat_args; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim db As Database | |
Dim rs As Recordset | |
Dim sql As String | |
Dim id as Integer | |
id = 20 | |
sql = "SELECT * FROM MyTable " & _ | |
"WHERE id = " & id | |
Set db = CurrentDb | |
Set rs = db.OpenRecordset(sql) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// only some users can view shop pages | |
add_action( 'template_redirect', 'check_user_view' ); | |
function check_user_view(){ | |
if( is_some_shop_page() ){ | |
// we are in some woocomerce (shop) page | |
if( !( user_can_view_shop() ) ){ | |
wp_redirect( get_home_url() ); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Change "Random Products" widget title | |
*/ | |
add_filter( 'widget_title', 'woo_widget_title', 10, 3); | |
function woo_widget_title( $title, $instance, $id_base ) { | |
if( 'woocommerce_random_products' == $id_base) { | |
return __( "My New SuperTitle", 'my_text_domain' ); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add product categories to the "Product" breadcrumb in WooCommerce. | |
// Get breadcrumbs on product pages that read: Home > Shop > Product category > Product Name | |
/* | |
* CAUTION: if a product is in more than one category, only show the first found category. | |
*/ | |
add_filter( 'woo_breadcrumbs_trail', 'woo_custom_breadcrumbs_trail_add_product_categories', 20 ); | |
function woo_custom_breadcrumbs_trail_add_product_categories ( $trail ) { | |
if ( ( get_post_type() == 'product' ) && is_singular() ) { | |
global $post; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* login redirect to index (all users) | |
*/ | |
add_filter( 'login_redirect', 'my_login_redirect' ); | |
function my_login_redirect(){ | |
return site_url(); | |
} | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* @goliver: overwrite function for get thumbnail without resize | |
* original in woocommerce-template.php | |
*/ | |
function woocommerce_get_product_thumbnail( $size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0 ) { | |
global $post; | |
if ( has_post_thumbnail() ) | |
return get_the_post_thumbnail( $post->ID ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* @goliver: overwrite function for get category thumbnail size without resize | |
* original in woocommerce-template.php | |
*/ | |
function woocommerce_subcategory_thumbnail( $category ) { | |
global $woocommerce; | |
$small_thumbnail_size = apply_filters( 'single_product_small_thumbnail_size', 'shop_catalog' ); | |
$dimensions = $woocommerce->get_image_size( $small_thumbnail_size ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* @goliver: remove hook woocommerce_template_loop_rating for not displaying rating in | |
* shop loop | |
*/ | |
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* remove "You are here" from breadcrumb | |
*/ | |
add_filter('woo_breadcrumbs_args','lgpd_breadcrumb_args_filter'); | |
function lgpd_breadcrumb_args_filter( $args ){ | |
$args[ 'before' ] = ''; | |
return $args; | |
} |
OlderNewer