Variable Sidebar Content
-
Hello, I’m very new to WordPress themes and I am trying to design my own. I don’t want to have any widgets on my sidebar, I only want a color bar to show up on every page, I want the color to change depending on the category being viewed but I’m having trouble writing the code for this, I keep getting error after error…
Here is what I would like to show on most pages:
<div class="bar1"></div> <div class="bar2"></div> <div class="bar3"></div>
Then for category 1 I want to show
<div class="bar1A"></div>
, for category 2<div class="bar2A"></div>
and category 3<div class="bar3A"></div>
I tried creating 2 different sidebars but had no success either. I tried the code below:
<div id="bar"> <?php if (is_category( '1' ) ) { ?> <div class="bar1A"> </div> } <?php if (is_category( '2' ) ) { ?> <div class="bar2A"> </div> } <?php if (is_category( '3' ) ) { ?> <div class="bar3A"> </div> } <?php elseif { <div class="bar1"></div> <div class="bar2"></div> <div class="bar3"></div> ?> </div>
But I only get errors… I change somethings here and there and then get no sidebar at all, or parse errors…
Can anyone help me, please?
- The topic ‘Variable Sidebar Content’ is closed to new replies.