I realized that I didn’t clarify how to do this very well. Sorry. Anyhoo… For single pages, you’ll want to use the following but change the name for each sidebar page you want to be different. So if you have different sidebar content for you about page and your portfolio page this is how it would look:
< ?php if (is_page(about)) { ?>
< ?php if (is_page(portfolio)) { ?>
I learned today how to use one sidebar page for multiple pages with different sidebar content for each page. It may come easy to most of you but for me it was a great revelation. It’s fairly simple to do and why I hadn’t learned it before now is beyond me. I guess some days things just click.
Anyway, if you use Wordpress as a CMS (which I encourage anyone to do) these are the steps for having multiple sidebar content in one sidebar page (sidebar.php).
This method is only for using a static homepage and a static blog page
For the static Blog Page
< ?php if (is_home()) { ?>
CONTENT GOES HERE
< ?php } ?>
For Single Pages
< ?php if (is_page(about)) { ?>
CONTENT GOES HERE
< ?php } ?>
It’s that simple and the content you want for each individual page shows up only on that page. I can’t believe I’ve been missing out on this all this time.
@Jeromy: I’d guess that if you’d need different content for each sub-page, it would work just as it does above. I personally rather have one rather large file, than dozens of template files.
Any idea how to accomplish this with subpages as well? LIke if I want a sidebar to show on About Us and all it’s subpages? THAT would be huge
@Sparkybarkalot : Very nice. Most of the clients I do work for have static sidebars, so my solution works for me but I’ll have to keep the other one linked for clients who are more hands on.
Your idea works, but I wanted something more “client friendly” for a site that had multiple static pages. Found this:
http://www.noscope.com/journal/2005/05/pages-with-editable-sidebars
Trying it now, but looks more promising than your (very nice and very workable) solution
As a helpful hint, I think it should be stated that you’ll want to replace the red text that is your post slug with the post slug within quotes. That is, you would do something like this:
I don’t know if that was made clear enough in your post for most designers to catch on. Great post, though, and thanks for the quick tips.