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.

I am using WordPress Custom Menus. I have links like

  • Home - Rendered using home.php
  • Blog - Rendered using page-blog.php with WP_Query to get blog posts
  • Services - Page
  • Portfolio - Rendered using page-portfolio.php to get all posts of the Custom Post Type "Portfolio"
  • Contact - Page

I will like to determine which link is current and style them. How will I do that? WordPress wont know which is selected when I am in a simple blog post for example single.php

share|improve this question
1  
.current-menu-item ? –  onetrickpony Apr 18 '11 at 5:19
    
@One Trick Pony, yes but that wont work when I am in a single post page for example? –  JM at Work Apr 18 '11 at 5:35
    
You want blog to show when on a single post? –  Bainternet Apr 18 '11 at 6:59

1 Answer 1

up vote 1 down vote accepted

for category:

  • li.current-category-ancestor
  • li.current-cat

for menu:

  • li.current-menu-item

for page:

  • li.current_page_item
  • li.current-page-ancestor

for post:

  • li.current-post-ancestor

For more details: http://codex.wordpress.org/Dynamic_Menu_Highlighting

share|improve this answer

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.