Support » Plugins » Dynamic menu:How to highlight category when single post is displayed?

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

    This example, adapted 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:

    <li<?php if ( is_category('10') || in_category('10') && !is_single())
     { echo ' class="current"'; } ?>><a href="/?cat=10">My Category</a></li>

    Any thoughts?

Viewing 1 replies (of 1 total)
  • tnk

    (@tnk)

    change !is_single() for is_single()

    the ! is telling NOT in single

Viewing 1 replies (of 1 total)
  • The topic ‘Dynamic menu:How to highlight category when single post is displayed?’ is closed to new replies.