Custom Sidebar Creation – Widgets are disappearing

Community Forums Forums General Discussion Custom Sidebar Creation – Widgets are disappearing

This topic is: not resolved

This topic contains 4 replies, has 2 voices, and was last updated by  David Chu 1 year, 7 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #99548


    I am using Genesis with the News Pro Child theme.

    I’m trying to add some additional functionality to this theme. I added an
    additional widget to the functions.php file. Code is:

    genesis_register_sidebar( array(
    ‘id’ => ‘kd-secondary-menu’,
    ‘name’ => __( ‘Secondary Menus’, ‘news’ ),
    ‘description’ => __( ‘Place Custom Menu Widgets here and use widget logic
    to change out the secondary menu.’, ‘news’ ), ‘before_widget’ => ”,
    ‘after_widget’ => ”,
    ) );
    I added that right after the after-entry register sidebar code. The
    sidebar shows up in the backend, but whenever I add any widgets to this,
    they don’t stay. I see them there and I can edit and tweak them, but if I
    leave the widget page or reload it, the widgets are gone from that area.
    I’ve looked at my code and everything looks good, so I’m not sure what the
    issue could be.

    I tried using just the regular “register_sidebar” code, but that had the
    same effect. I did have “widget logic” plugin installed, and then I
    removed it, but neither one fixed the issue.

    I disabled all plugins, but the issue persisted. Anyone have any ideas on this?


    David Chu

    I tested your code, and it works fine on my test system. I didn’t change my theme to show it, but my widgets I put in and played with worked fine. You even have the courteous translation bits in there. :-)

    That’s a mystery, the only idea that comes to mind is that maybe the “before widget” and “after widget” areas want single quotes instead of double quotes. I did make that change when I tested. But I realize that this might be this forum’s normal text butchering, not your actual code. :-)


    Dave Chu · Custom WordPress Developer – likes collaborating with Designers



    The sidebar shows up in the Appearance > Widgets. But when I add a widget to it and go away and come back, that widget is gone.



    Let me add a little bit more that I just realized. Apparently, all the widgets I am adding are going into the “inactive widgets” section when I navigate away from the widget page. It’s almost like the widgets don’t recognize the sidebar id or something.

    Maybe that can spur some thoughts or ideas?


    David Chu

    Yes, I realize that it goes away when you navigate away. But your code works for me when I navigate there and back. So I have no suggestions for the code itself.

    It’s possible that something else in your theme is conflicting with it. You could, I suppose, try making a simpler widget declaration than that and see if the same thing happens. If so, then I’ll vote for a theme conflict somewhere. You could also try placing your declaration in another part of your functions.php. That’s all I can suggest without an investigation.

    Good luck, Dave

    Dave Chu · Custom WordPress Developer – likes collaborating with Designers

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.