I’m building an ecommerce store with Woocommerce for WordPress using the Storefront theme. I created a child theme to remove the default sidebar, however this also has the side effect that widgets in the footer widget areas are not displayed. If I switch back to the parent theme, they work just fine.
This is the functions.php of the child theme:
<?php
function mb_remove_sidebar() {
return false;
}
add_filter( 'is_active_sidebar', 'mb_remove_sidebar', 10, 2 );
How can I get the footer widgets back?
2
Answers
Your code is removing all sidebars. Note the sidebar ID you want to remove and then unregister the specific sidebar.
For more information see https://codex.wordpress.org/Function_Reference/unregister_sidebar
The best way to do this in my opinion would be to create your own
sidebar.php
file in your child them to overwrite the parent and edit the code here instead of within your functions.Below is the default file, you can simply remove the exclamation mark in the if statement.