Who knew I’d be making a series of posts!? Part the Third is all about ‘per page sidebars.’ Inspiration struck as I was finally able to visualize how I’d want it to look, and it’s stupid simple.
First and foremost, it’s hidden by default in the Screen Options. This is important, since while I totally agree to use decisions, not options, this is something people need options for, but at the same time it is not something everyone will use. The fact that there aren’t more plugins that do it is paramount in that deduction. I know of two, after all, and one requires you to think. A lot. And while thinking isn’t bad, when you’re new, you want things to be straight forward and make sense. As subjective as that can be.
My idea is that by default, you use the default sidebars. Assuming you’ve defined them as I detailed out in my previous post, let’s play pretend…
- I’m using the TwentyEleven theme with the following widget areas: Main Sidebar, Footer Area One, Footer Area Two, Footer Area Three, Showcase
- I’m using a Static Front Page
- I want a special sidebar only on that static front page
- My theme uses a reasonable number of sidebars (i.e. 10 or less)
- I’ve already setup my defined sidebar sets as follows:
- Primary (for use on Main Sidebar)
- Footer left (for use on Footer Area One)
- Footer middle (for use on Footer Area Two)
- Footer right (for use on Footer Area Three)
- Front Page Footer Left (for use on Footer Area One on the static front page only)
What’s that!? Front Page Footer Left? How ever will I define that? Where do I define it? If I only want that sidebar set (Chip, that’s for you) to show up on one page, I could either figure out how to select a page on the Widget/Sidebar editor, or I could do it on the Page Editor. For the purpose of this post, we’re doing it on the page.
Why? Well, it’s a split decision, and without any studies to back it up one way or the other, I suspect that people think ‘You know, I wrote this page, and I want a special sidebar here.’ and not ‘I wrote this special sidebar and want it to show up there on that page.’ My use of this/that and here/there were very purposeful. You think about the sidebars you want while you’re on the page they’re intended for. Therefore, you should define the sidebars on that page. The same argument could be made the other way, I’m aware of this. Just go with me for now.
We go to edit the page and first turn on manage sidebars(You can now see what other options I have going on.):
That gives me a brand new post meta box:
See why I said ‘reasonable number of sidebars’? This could get way out of hand, way fast. You may also note that they all default to … (Default). Well go back to my other idea of having a selection of where to use a sidebar and this makes sense. If you define a sidebar area back there, then that’s the assumed Default sidebar. When you want a specific page to have a totally different sidebar, we should store this information on the page, not in the sidebar/widget like we do today with Widget Logic, etc.
I can use the drop down boxes to show all the available sidebar sets:
Boom. I’m set for this page.
However. This doesn’t solve a big problem: What if I want a special sidebar for specific categories or archives? I’m still doodling on that one, but my first thought is what if certain ‘names’ were reserved. So if I made a sidebar named ‘categories’ it would automagically be used for categories, working on the same concept of the template hierarchy. All things being equal, it defaults to what you picked on the Widgets page.
By the way, these are the original doodles: