0

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

3
  • 1
    .current-menu-item ? Apr 18, 2011 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, 2011 at 5:35
  • You want blog to show when on a single post?
    – Bainternet
    Apr 18, 2011 at 6:59

1 Answer 1

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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