Jump to content

WordPress dynamic menu


slobjones

Recommended Posts

I'd like my WordPress menu to highlight the category when a single post is displayed.

 

This example from the WordPress codex properly applies the class of "current" in category view, but does not apply the class (although it should) when switching to single-post view:

[pre]<li<?php if ( is_category('10') || in_category('10') && !is_single())

{ echo ' class="current"'; } ?>><a href="/?cat=10">My Category</a></li>[/pre]

Any thoughts?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/180363-wordpress-dynamic-menu/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.