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.
Hi Jen,
Hope all’s well with you lately. I didn’t know this simple piece of code either, but no doubt it’ll come in useful. Thanks for writing about it!
David- All is well. It’s one of those pieces of code that make you smack your head when you find it.
[…] Jen at Pop Stalin teaches us the code to create different sidebar content on various pages of your WordPress blog. 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). […]
I used Wordpress a while ago, but found it very confusing and not that easy to configure. I’ll try again later…
This will be a nice way to consolidate my sidebar files, thanks!