I've the following navigation: (example)

<ul id="mainNav">
    <li><a href="#" class="watishet">Wat is het</a></li>
    <li><a href="#" class="hoewerkthet">Hoe werkt het?</a></li>
    <li><a href="#" class="resultaten">Resultaten?</a></li>
    <li><a href="#" class="onconavigator">OncoNavigator?</a></li>
    <li><a href="#" class="ziekenhuizen">Ziekenhuizen?</a></li>

Can I add custom classes to a anchor element inside Wp_list_pages? because the current wp_list_page doesn't use a class attribute inside a anchor element. I want to add a unique class to each anchor element. For final result, I want to make a tab based horizontal dropdown menu.

I looked for couple of WordPress dropdown menu plugins but there wasn't anything out there that fulfill my wishes.


1 Answer 1


Use the Wordpress Menu system, which allows you to set custom classes (Make sure you open up "Screen Options" and check the "CSS Classes" check box to see the settings)

  • tnx mate but does the menu system add those classes to list or anchor? is it <li class="bla"> or <a class="bla"> Tnx
    – Navid
    Aug 3, 2011 at 8:42
  • It adds it to the li (<li class="bla">) - there is no easy way to add a class to the <a> tag, so I'd suggest using this option and modifying your CSS or JavaScript - whatever is using the a.class should be able to be slightly modified to use the li.class.
    – GavinR
    Aug 3, 2011 at 18:42
  • Aah oke tnx mate it already works.
    – Navid
    Aug 4, 2011 at 9:46

Your Answer

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

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