WordPress.org

Ready to get started?Download WordPress

Forums

widgets disappear from admin when reloading (14 posts)

  1. redgoatcreative
    Member
    Posted 4 years ago #

    I've successfully implemented some custom sidebars, they show up in the widget cp and on the page when I add a widget, however once I return to the widget cp page they're gone. I don't think this is a plugin issue as the widget I'm using is the default text/html widget. I can drag it over, add content and save to have it display on the page, but then the widget is gone one I return to the cp. Help!

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    Have you tried:

    - deactivating all plugins to see if this resolves the problem? If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    - resetting the plugins folder by FTP or phpMyAdmin? Sometimes, an apparently inactive plugin can still cause problems.

  3. redgoatcreative
    Member
    Posted 4 years ago #

    Thanks for the reply.

    I did try deactivating all plugins, then testing the text/html widget in one of the sidebars, but that didn't change anything. Tried your suggestion on resetting the plugins folder but that also yielded the same result.

    It's updating the text on the page when I add a "new" text widget, but it seems to replace the previous text widget, rather than adding the widget.

  4. esmi
    Forum Moderator
    Posted 4 years ago #

    Perhaps there's a problem in your theme's functions.php file when you register the sidebars?

  5. redgoatcreative
    Member
    Posted 4 years ago #

    Just realized the other widgets on the page disappear when I update any one of the others.

    Here's the functions.php code:

    if ( function_exists('register_sidebar') ) {
    	register_sidebar( array(
            'name' => ('Main Sidebar'),
            'id' => 'sidebarMain',
            'description' =>  ('Main site sidebar (default)'),
            'before_widget' => '',
            'after_widget' => '',
            'before_title' => '',
            'after_title' => ''
        ) );
    	register_sidebar( array(
            'name' => ('Homepage Sidebar 1'),
            'id' => 'sidebarHomepage1',
            'description' => ('Use to create 3 column layout on homepage.'),
            'before_widget' => '<div class="hpColumn1">',
            'after_widget' => '</div>',
            'before_title' => '<h2>',
            'after_title' => '</h2>'
        ) );
    	register_sidebar( array(
            'name' => ('Homepage Sidebar 2'),
            'id' => 'sidebarHomepage2',
            'description' => ('Use to create 3 column layout on homepage.'),
            'before_widget' => '<div class="hpColumn1 hpColumn2">',
            'after_widget' => '</div>',
            'before_title' => '<h2>',
            'after_title' => '</h2>'
        ) );
    	register_sidebar( array(
            'name' => ('Homepage Sidebar 3'),
            'id' => 'sidebarHomepage3',
            'description' => ('Use to create 3 column layout on homepage.'),
            'before_widget' => '<div class="hpColumn1">',
            'after_widget' => '</div>',
            'before_title' => '<h2>',
            'after_title' => '</h2>'
        ) );
    	register_sidebar( array(
            'name' => ('Contact Sidebar'),
            'id' => 'sidebarContact',
            'description' => ('Use for contact form.'),
            'before_widget' => '',
            'after_widget' => '',
            'before_title' => '',
            'after_title' => ''
        ) );
    	register_sidebar( array(
            'name' => ('Blog Sidebar'),
            'id' => 'sidebarBlog',
            'description' => ('Use for contact blog.'),
            'before_widget' => '',
            'after_widget' => '',
            'before_title' => '',
            'after_title' => ''
        ) );
    
    }

    Anything stand out as being wrong?

  6. esmi
    Forum Moderator
    Posted 4 years ago #

    Nothing in that strikes me as a potential problem.

    Just realized the other widgets on the page disappear when I update any one of the others.

    Can you just clarify what you mean by "widgets"? Are these literally other widgets from Appearance/Widgets that you've added to the sidebar(s)? Or are you talking about the default sidebar content when there are no widgets?

    Only, if it's the latter, that's standard behaviour in many sidebars (dependant on the sidebar coding). The Widgets replace the default content.

  7. redgoatcreative
    Member
    Posted 4 years ago #

    I added a text/html widget to Homepage Sidebar 1 and the widgets that were in 2 and 3 are no longer on the page.

    Then I added a text/html widget to the Main Sidebar and the widget previously in Homepage Sidebar 1 is no longer there.

  8. redgoatcreative
    Member
    Posted 4 years ago #

    Still haven't found a solution. Any other thoughts or other suggestions would be greatly appreciated!

  9. redgoatcreative
    Member
    Posted 4 years ago #

    Just noticed something odd...all of the "test" text/html widgets I've been adding that have disappeared have ended up in the inactive widgets area of the widget cp. I dragged one of the previous text/html instances from there back into the sidebar, which worked fine, but on the widget cp reload it was removed from the sidebar and placed back into inactive status.

    What did I do wrong?!

  10. esmi
    Forum Moderator
    Posted 4 years ago #

    Have you tried setting up some widgets within the default theme to confirm that this is a problem in your current theme?

  11. redgoatcreative
    Member
    Posted 4 years ago #

    Yes, it's only in my theme - the default behaves correctly. If it helps, here's the code I have calling the sidebar functions on my homepage template. Not sure where else the problem might be.

    <?php if (dynamic_sidebar('HomepageSidebar-1')) : ?>
    <?php endif; ?>
    <?php if (dynamic_sidebar('HomepageSidebar-2')) : ?>
    <?php endif; ?>
    <?php if (dynamic_sidebar('HomepageSidebar-3')) : ?>
    <?php endif; ?>
  12. esmi
    Forum Moderator
    Posted 4 years ago #

    Aha! The names of the sidebars in your homepage template code (above) don't match the the names of the sidebars registered in functions.php - 'Homepage Sidebar 1', 'Homepage Sidebar 2' & 'Homepage Sidebar 3'.

  13. redgoatcreative
    Member
    Posted 4 years ago #

    Heh, whoops...sorry about the confusion. I had updated the function calls as in that last post and the arrays in function.php to match (just didn't post the arrays since you commented they looked good). I had found a post where the person was having similar difficulty and resolved it by removing the spaces in the Sidebar names, so I gave it a try. Wish it had worked!

  14. Kraignos
    Member
    Posted 3 years ago #

    I made a custom widget area editable from the Control Panel and I had EXACTLY the same problem: widgets disappearing after reloading, going in the desactivated-widgets zone.

    I resolved it by removing the spaces in the name and description of the widget area (when registering it in the theme function), like you said in your last post. weird....

    Then I tried to reproduce the bug by adding spaces again in the name and description but it seems the bug has gone for ever :P

    Anyway, thank you it worked for me! (in case one day you come back to read this post, yeah 8 month later...)

Topic Closed

This topic has been closed to new replies.

About this Topic