• Please help – I have a theme I like (Massive News) that comes pre-loaded with sidebar material, such as tags, an advertising spot, side blog and feed subscriptions (these are included in the code for the sidebar.) But whenever I go to add a new widget, all of those pre-loaded materials are gone. I want to keep them AND add new widgets. Please help, thank you.
    The site I’m experimenting with is http://soundcitizen.com.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter soundcitizen

    (@soundcitizen)

    Update: After adding a widget, the code for the sidebar remains intact, but the sidebar does not display.

    You have errors on the entries with images you posted and other errors. I would think if you clean up the code your problem will go away or be much easier to solve. Validate your code here, http://validator.w3.org

    Hi SoundCitizen,

    The sidebar.php file in your theme likely has this line of code in it.

    <?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar() ) : ?>

    Thus, once you add a new widget, Word Press disregards the code in the sidebar.php file until it reaches the “end” code, and instead displays the widgets you have selected in the Word Press GUI. If you would like to keep all of the sidebar widgets that come with your theme and add new widgets, you can install the particular plugins that you would like to add and then add the corresponding php code to your theme’s sidebar.php file

    Cheers!

    Oops! I forgot. Another easy way to keep your widgets and add new ones is to move the location of this line of code <?php endif; ?> which is most likely at the bottom of your sidebar.php file and movie it directly below this line of code <?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar() ) : ?>

    Hope this helps.

    Wow! tyberdev, thank you! I have searched for this answer a long time. Finally someone tells me exactly what the problem is and the solution. You are a genius. I never would have thought to move the endif.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Sidebar disappears when widgets installed’ is closed to new replies.