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.

On my Wordpress site I have a three level navigation. In the second level of every main navigation item is a "toolkit" page.

I would like to highlight this page in the navigation. Is there anyway that I can add a class to a page, so that I could style its navigation link separately? Is there a plugin out there that would allow me to do this?

I'm hoping it would be something like in the Page Editor screen is a custom field that allows me to input a class. The class is then generated when calling the WP_List_Pages function. Then with some simple CSS and can change the background of all those links.

Thanks in advance.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

You could also simply use css: #menu-item-ID (where "ID" is the unique ID of the page/post/category/whatever).

share|improve this answer
    
This is what I had to end up doing using wp_list_pages() because the Wordpress Menu function wasn't working. Not ideal, but it works. –  Vian Esterhuizen May 26 '11 at 20:16

In the menu editor open the "Screen options" tab, and check the "CSS classes" checkbox. Now you can add any class you like to each menu item

share|improve this answer
    
Oh. I would have to use a custom menu to achieve this? –  Vian Esterhuizen May 13 '11 at 22:14
    
oh, sorry, I missed that you are using WP_List_Pages. That function automatically add a class to every <li> with the ID of the page: page-item-ID. You can use CSS selector ul li.page-item-ID a{ ... } to customize that link –  MZAweb May 13 '11 at 23:26
    
also, if you define your body like: <body <?php body_class(); ?>> WP add an unique class to each page, post, category, etc –  MZAweb May 13 '11 at 23:30

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.