nav menu question
-
I’d like a nav menu that highlights the current page (or at least parent page). I have this working based on an example. However, when on a blog post permalink page, I’d like the menu to light up a specific item (Archives). I know I can figure out if I’m on a blog post with is_single(), but I’m not sure how to manip the menu code to accomodate this.
Basically, I’m talking about a site with a pretty normal blog post filled front page, but with also using Pages with other content. The menu lists each top Page. However, for permalink pages I want the ‘Archive’ menu item to light up (the Archive Page will serve as an archives index).
The code I’m using now is:
<ul class="navigation">
<?php if (is_home()) {$pg_li .="current_page_item";} ?>
<li class="<?php echo $pg_li; ?>">
<a href="<?php bloginfo('siteurl'); ?>" title="home"><span>home</span></a></li>
<?php wp_list_page('depth=1&title_li=&exclude=6' ); ?>
</ul>
It seems like the wp_list_page() is basically running through the list of pages and spitting out
<li>
tags for each one. How can I intervene and say if is_single() then set ‘archives’ to current_page_item?
thanks
- The topic ‘nav menu question’ is closed to new replies.