WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
.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
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


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.