How to add widgets to your theme without hiding the current ones
If you just got a new theme, free or premium and you want to add some widgets to your sidebar the following problem will occur: Whenever you add a widget from your admin panel, the current widgets will disappear.
This is happening because theme sidebars are coded in that way to let you choose what to display from the administration panel OR let the default ones to appear. If you want to display the template coded widgets and to add more from the administration panel that will not hide the previous ones, you have to do a little coding in your template file.
The sidebars are most likely present in sidebar.php file. First of all, try open sidebar.php with a text editor ( or use the template editor within administration panel ) and search for something like this:
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
Now, locate the end of the if statement:
<?php endif; ?>
Copy all the content between these 2 lines and paste it before the first if statement ( the one you searched for ), so the two lines that you looked for will have nothing inside.
Now the default widgets will appear along the widgets you add from your admin panel. To delete one of these widgets you have to manually delete it from the sidebar.php file.
Disclosure: Some of the links in this post are "affiliate links." This means if you click on the link and purchase the item, I will receive an affiliate commission
Leave a Reply