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.

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. May 26 '11 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? 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

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.