26 Oct 2007

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:

  1. < ?php if (is_page(about)) { ?>
  2. < ?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

  1. < ?php if (is_home()) { ?>
  2. CONTENT GOES HERE
  3. < ?php } ?>

For Single Pages

  1. < ?php if (is_page(about)) { ?>
  2. CONTENT GOES HERE
  3. < ?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.

11 Comments

  1. 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!

  2. No. 2 Pop Stalin 07/23/07

    David- All is well. It’s one of those pieces of code that make you smack your head when you find it. :)

  3. […] 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). […]

  4. No. 4 Fred 07/26/07

    I used Wordpress a while ago, but found it very confusing and not that easy to configure. I’ll try again later…

  5. No. 5 beth 08/06/07

    This will be a nice way to consolidate my sidebar files, thanks!

Tell Me What You Think

About Me

My name’s Jen; I’m a cynical, sarcastic, ex-drummer who is fond of dark humor. I've held way too many factory & retail jobs but finally found my calling one Christmas holiday in a dark, musty basement. I am now a CSS & XHTML web standards looney and can be found daily—when I’m not at my Mac—at the local fair-trade coffee shop buying an iced-soy mocha no matter the temperature.

I am also the owner of Pop Stalin Design specializing in CSS & XHTML web design as well as custom WordPress themes.