Code Snippets plugin not working in my site
-
Hi:
I’ve used this plugin in almost all sites I’ve done in wordpress. It’s wonderful.
But snippets are not working in this site: bertallonch.com/shop. I’ve tried several different snippets and nothing happens, it’s like the plugin is not running
Is there any way to know if plugin is running ok or not? Is there a way to know why snippets are not loaded?Some of the snippets (quite basic) I’ve used:
add_action( ‘woocommerce_before_shop_loop_item_title’, ‘bbloomer_display_sold_out_loop_woocommerce’, 10 );
function bbloomer_display_sold_out_loop_woocommerce() {
global $product;if ( !$product->is_in_stock() ) {
echo ‘<div class=”circile-hot circle-shop”>’ . __( ‘Agotado’, ‘woocommerce’ ) . ‘</div>’;
}
}(this code works when I add it directly in the file)
add_action( ‘pre_get_posts’, ‘custom_pre_get_posts_query’ );
function custom_pre_get_posts_query( $q ) {
if ( ! $q->is_main_query() ) return;
if ( ! $q->is_post_type_archive() ) return;
if ( ! is_admin() ) {
$q->set( ‘tax_query’, array(array(
‘taxonomy’ => ‘product_cat’,
‘field’ => ‘slug’,
‘terms’ => array( ‘sin-categoria’, ‘descartes’, ‘estudio-del-color’, ‘mariposario’, ‘mi-transporte-favorito’, ‘peces’ ), // Don’t display products in the membership category on the shop page . For multiple category , separate it with comma.
‘operator’ => ‘NOT IN’
)));
}
remove_action( ‘pre_get_posts’, ‘custom_pre_get_posts_query’ );
}
Thanks
- This topic was modified 4 years, 2 months ago by .
- This topic was modified 4 years, 2 months ago by .
- This topic was modified 4 years, 2 months ago by .
The page I need help with: [log in to see the link]
- The topic ‘Code Snippets plugin not working in my site’ is closed to new replies.