I am trying to modify the WooCommerce product filter plugin to add the filter as a <div class="row">
instead of "col-md-6"
.
In functions.php, I have removed the actions which hook into functions that create col-md-6
, written new functions that create row
s, and added actions that hook into my new functions. See code below.
function filter_styling()
{
echo '<div class="row">';
}
function filter_styling2()
{
echo '</div><div class="row">';
}
function product_category_filter_changes()
{
remove_action('woocommerce_before_main_content','oxy_before_breadcrumbs', 19);
remove_action('woocommerce_before_main_content', 'oxy_after_breadcrumbs', 20);
add_action('woocommerce_before_main_content', 'filter_styling', 19);
add_action('woocommerce_before_main_content', 'filter_styling2', 20);
}
add_action('init','product_category_filter_changes',10);
The add actions are registering, but not the remove actions. Any ideas?
Thanks!
Dan
Removing an action can only be done when an action has already been added. Because of this, the
'init'
hook is likely too early.I recommend using the
'template_redirect'
action hook, which will run after the plugins are loaded: