Hey everyone.
My first question here in the Wordpress Support Forums. My first post too actually. But ah well.
Anyway. Straight to my predicament.
I'm sorting out my blog (I'm unsure whether I can post a direct link so the URL is on my profile page for this forum) and have designed a pretty rad looking navigation system.
Its your everyday CSS based image navigation so that on hover the image will move position showing the hover version of the original image.
This is easy.
What my problem is that I'd like the navigation images to correspond with what page or post (within the category) the user is on.
So for example. The HOME link image will be 'active' while the user is on the index page or within the category of news. The MOVIES link image will be 'active' while the user is on the movies page or within the category of movies etc etc.
This is the code I'm using so far:
<div id="navigation">
<ul>
<li <?php if (is_home()) { echo "class=nav-home-on";
} elseif (in_category('14')) { echo "class=nav-home-on";
} else { echo "class=nav-home";} ?>></li>
<li <?php if (is_page('rants')) { echo "class=nav-rants-on";
} elseif (in_category('16')) { echo "class=nav-rants-on";
} else { echo "class=nav-rants";} ?>></li>
<li <?php if (is_page('rants')) { echo "class=nav-movies-on";
} elseif (in_category('15')) { echo "class=nav-movies-on";
} else { echo "class=nav-movies";} ?>></li>
<li <?php if (is_page('crap')) { echo "class=nav-crap-on";
} elseif (in_category('17')) { echo "class=nav-crap-on";
} else { echo "class=nav-crap";} ?>></li>
<li style="margin: 0;" <?php if (is_page('portfolio')) { echo "class=nav-portfolio-on";
} elseif (in_category('18')) { echo "class=nav-portfolio-on";
} else { echo "class=nav-portfolio";} ?>></li>
</ul>
</div>
At the moment I know I haven't added any links TO the lists but I just wanted to get this part of the code correct first.
While this worls it will also be screwy when there is for example a post on a page where teh category is different. So TWO parts of teh nav will be 'active'.
If any of this makes sense and ANYONE can help.
Please do :D
Thanks in advance.
Pete x