0

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.

2 Answers 2

0

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

1
  • 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. Commented May 26, 2011 at 20:16
2

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

3
  • Oh. I would have to use a custom menu to achieve this? Commented May 13, 2011 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
    Commented May 13, 2011 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
    Commented May 13, 2011 at 23:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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