Community Forums › Forums › Archived Forums › Design Tips and Tricks › Sidebar missing on custom archive page
Tagged: archive page, custom menu, Sidebar
- This topic has 10 replies, 2 voices, and was last updated 11 years, 10 months ago by csbeck.
-
AuthorPosts
-
January 11, 2013 at 9:28 am #11219csbeckMember
I've designed a custom site based on Agency though it's drastically different from Agency. I've created some custom Archive pages to show particular category posts and custom fields. Since updating Genesis (just this week) my sidebar is missing from these pages. Can someone take a look at my code to see if I'm doing something incorrectly?
Staging site: http://www.rdldev.beckerstudio.com
One of the pages in question: http://www.rdldev.beckerstudio.com/test-catalog/new-tests
Code for one of the Archive pages
January 11, 2013 at 9:36 am #11225csbeckMemberHere's the code for one of the Archive pages ( I had some challenges with putting the link in my original submission above):
https://gist.github.com/4511552As a further note, the sidebar is supposed to show a custom menu. I created the menu just fine and put it in a sidebar widget and it's showing on the parent page: http://rdldev.beckerstudio.com/test-catalog
So I know the menu and sidebar actually work. It's just they aren't showing up in my custom archive pages - although they did before I upgraded Genesis. Looking at the page source though for those archive pages in the browser, there is a div or section for the sidebar - it shows an empty div. It's strange. I'm betting though that I'm doing something wrong.Again, thanks for your time.
January 11, 2013 at 9:49 am #11234David DeckerMemberIn the Gist code snippet I can see no reference of a sidebar for displaying. There's currently no "get_sidebar( 'id-of-sidebar' );" function or for just a widget area, no "dynamic_sidebar( 'id-of-sidebar' );" function.
You need to add on or the other to your template to get an registered sidebar or widget area displayed.
January 11, 2013 at 10:10 am #11245csbeckMemberThanks so much David. Thanks to you I'm getting close. So I've added the sidebar in and it's showing now. But I can't see where to put it correctly. I've tried several places and it doesn't seem to end up in the <div id="sidebar"> instead it goes into a separate div below it. So styling is off, which I could deal with, but there is still a <div id="sidebar"> above my new div and there's still an empty text widget inside that. I'd ultimately like to replace the empty text widget with my sidebar so that styling works as it does on the Test Catalog page. Thoughts?
January 11, 2013 at 11:12 am #11260David DeckerMemberGreat 🙂
I understand what you mean! Please try to add this line of code before the first code line where it says "get_header":
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
Does that work?
January 11, 2013 at 11:43 am #11270csbeckMemberThanks David.
Unfortunately, it didn't remove the empty widget or put mine in that location.
Updated code: https://gist.github.com/4511552
January 11, 2013 at 11:58 am #11276David DeckerMemberAh, I've got it to work now and finally tested it before posting here... 🙂
Forked to this: https://gist.github.com/4512672
---> removed dynamic_sidebar... at the bottom --- changed/added stuff on top of file. For me this worked, I hope for you too 🙂
January 11, 2013 at 12:09 pm #11280csbeckMemberWow! Absolutely amazing. You are a magician. Thanks so much for helping.
BTW - the empty text widget is still in there. Weird. At least it's under mine so it doesn't mess it up.
Can you explain why this worked before the latest Genesis update?
January 11, 2013 at 12:19 pm #11286David DeckerMemberMmh, really don't know why it worked before v1.9.x --- the code we both used now should also work before v1.9. I have to do some deeper look into code changes between 1.8.x and 1.9.x before I might understand why...
For the text widget on your test site: I see it but it is definitely wrapped into THAT sidebar, so it must be an active widget in this sidebar otherwise I cannot explain it. On my test site I don't have it there.
Are you sure it isn't setup in this widget area?
So maybe this could also be some strange WP behavior where widget settings get mixed up internally... especially when changing themes or plugins (which register sidebars/widgets).
You could test with another sidebar id in the above code if it's still there.
January 11, 2013 at 12:26 pm #11288David DeckerMemberI just did a code comparison between 1.8.2 and 1.9.x and could not find any change that would have lead to your issue with the custom sidebar. To be honest, there aren't any changes at all regarding the sidebars between those versions 🙂
I assume there must be any other modification maybe that was blocking it. Anyways if it's working now, that's what matters 🙂 And from my point of view we've found Genesis/WP compliant way of doing it so it should be future-proof.
January 11, 2013 at 2:09 pm #11313csbeckMemberThanks so much for helping with the solution and looking into the issue. You have been very helpful. I'll look into switching things around to see if something shows why this worked earlier, but like you said, I'm mostly happy that it works without breaking.
You rock!
Chris
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.