Community Forums › Forums › Archived Forums › General Discussion › Custom Sidebar Creation – Widgets are disappearing
Tagged: custom sidebar, widgets
- This topic has 4 replies, 2 voices, and was last updated 8 years, 11 months ago by
David Chu.
-
AuthorPosts
-
April 10, 2014 at 3:10 pm #99548
klongpayabal
MemberI 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?
April 10, 2014 at 5:02 pm #99556David Chu
ParticipantHi,
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
Dave Chu ยท Custom WordPress Developer – likes collaborating with Designers
April 10, 2014 at 5:07 pm #99557klongpayabal
MemberThe 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.
April 10, 2014 at 5:42 pm #99560klongpayabal
MemberLet 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?
April 11, 2014 at 6:58 am #99638David Chu
ParticipantYes, 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
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.