Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

For our (new) website I figured out how to make menu's active. The only problem is that I want multiple pages, singles and categories under one active menu (just to remind people in what section they are).

How do I get this working?

Example: Below the menu gets the status 'active' when viewing the category-app-functies.php.

  <ul class="nav navbar-nav">
                   <li<?php if ( is_category('app-functies')) { echo ' class="current"'; } elseif ( is_singular( 'augmented-reality' )) { echo ' class="current"'; } ?>><a href="<?php echo site_url(); ?>/app-functies/">App Functies</a></li>      
      </ul>

Also when viewing url.com/app-functies/X/ I like to make the menu active aswell. Is this possible?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Ok, found it out:

 <ul class="nav navbar-nav">
               <li<?php if ( is_category('app-functies')) { echo ' class="current"'; } elseif ( is_singular( 'augmented-reality' )) { echo ' class="current"'; } ?>><a href="<?php echo site_url(); ?>/app-functies/">App Functies</a></li>      
  </ul>

If you want to add more then 1 is_category() you can also use is category('') || is_singular('') .

Basic PHP knowledge.. but not for a designer like me. Hope this help a lot for other people as well.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.