I’ve found the reason. That’s how I registered my sidebar:
register_sidebar( array(
'name' => 'Product filters',
'id' => 'product_filters',
/*'before_widget' => '',
'after_widget' => '',*/
'before_title' => '<div class="hidden">',
'after_title' => '</div>',
) );
The commented out part is what was causing the issue with missing id’s. I thought when it’s empty it just means that WP will not add any wrappers around them, turns out it also removes them… So without these 2 lines the markup is fine.
However, I still need to move “wcapf-before-products” wrapper elsewhere, because with my custom theme it wraps filters before products and not the products. I guess it should be fine with the default Woocommerce layout, so there’s no need for changes in plugin’s core. I’ve found where this wrapper is hooked, but I can’t remove these hooks in my theme’s functions.php. It works perfectly if I comment out these 2 lines in plugin’s hooks.php:
add_action('woocommerce_before_shop_loop', array('WCAPF', 'beforeProductsHolder'), 0);
add_action('woocommerce_after_shop_loop', array('WCAPF', 'afterProductsHolder'), 200);
Here’s what I tried in my functions.php:
add_action('woocommerce_before_shop_loop', 'my_before_shop_loop_remove');
function my_before_shop_loop_remove() {
remove_action('woocommerce_before_shop_loop', array('WCAPF', 'beforeProductsHolder'), 0);
}
add_action('woocommerce_after_shop_loop', 'my_after_shop_loop_remove');
function my_after_shop_loop_remove() {
remove_action('woocommerce_after_shop_loop', array('WCAPF', 'afterProductsHolder'), 200);
}
But it doesn’t change anything. I’ve also tried higher numbers for priority with no result. What am I doing wrong?
-
This reply was modified 8 years, 6 months ago by
Dmitry_Demir.