Menu issue for months, no answer yet…Anybody?
-
I am using dynamic menu highlighting as suggested in the wordpress codex.
It is working on almost all of my pages. However, I have a portfolio section called ‘Work’ with multiple sub categories and I cannot get the subcategories and single posts within these subcategories to highlight the main portfolio ‘Work’ link.
Here is what I mean. I have a top level menu link of ‘Work’. Within that there are subcats of interactive, print, outdoor, etc, etc.
when I am in a subcategory or post of one of the subcategories of the main portfolio ‘Work’ link itself I want the ‘Work’ link to be highlighted. This is the code I am using:
<li<?php if (is_category(array('interactive','microsite','email','print')) { echo " id=\"current\""; }?>> <a>Work</a> <ul> <?php wp_list_categories("exclude=$blog_ID&title_li="); ?> </ul> </li>
This is giving me an error. I can sort of see why….but I don’t know how to correct it. Would I need to use an elseif statement within this particular list item?
Here’s the site: http://newsite.blairshapiro.com
Any help would be hugely appreciated!
-
if (is_category(array('interactive','microsite','email','print'))
The above has a missing
)
I always use this general format so that I can use regular code:
<?php if (is_category('a')) { ?> <!-- code here --> <?php } elseif (is_category(array('b','c'))) { ?> <!-- code here --> <?php } elseif (is_category('d')) { ?> <!-- code here --> <?php } else { ?> <!-- code here --> <?php } ?>
For posts (not category pages), see: http://codex.wordpress.org/Template_Tags/in_category
Also see: http://codex.wordpress.org/Template_Tags/wp_list_categories#Markup_and_Styling_of_Category_Lists
Hi,
Thanks for the response. I’m somewhat of a newbie, and not sure I understand how to implement your suggestion, or the codex examples which look like they may be right on target.
Any way you can show me an example of exactly what the code might look like to achieve my goal?
If it were me, I would style li.current-cat and li.current-cat-parent in my theme’s style.css. I’m not sure what could do on individual post pages since these are not categories, probably something with in_category and current_category in wp_list_categories.
Thanks for the reply.
So if I use the css route, I don’t have to do anything to the php?
- The topic ‘Menu issue for months, no answer yet…Anybody?’ is closed to new replies.