Support » Themes and Templates » Appyling different classes to navigation

  • Resolved staceyk18



    I am putting together a website using WordPress, and I am trying to colour theme my navigation into 3 different colours. Is there a plugin available that lets me assign a “class” to a page in order to theme it, or another way of doing this? Or is this not possible…

    All advice would be appreciated!!


Viewing 4 replies - 1 through 4 (of 4 total)
  • If you mean in your wp_list_page list then wordpress already assigns a class to them. Check your pages sourcecode (not the PHP but through your browser when viewing the page) and you will notice that it assigns classes to each list item. They will be in the following format:

    page_item page-item-2 with the number being the page id. Create a class with this name in your stylesheet and this should work.

    Fantastic!! Thank you! Works perfectly

    Another question, are you able to split the page lists? eg. split the list to have it display half on the left and half on the right handside, without it being a widgets sidebar?

    Sorry, still quite new to wp templates.


    Yes – just call the <?php wp_list_pages(); ?> on both sides and then use the include function to only list certain pages in each list.

    For example on the left you could have the following code:

    <?php wp_list_pages('include=2,3,4,5'); ?>

    Which will include pages with id’s of 2,3,4,5 and no other pages.

    On the right you could have the following code:

    <?php wp_list_pages('include=6,7,8,9'); ?>

    Which will include pages with id’s of 6,7,8,9 and no other pages.

    That way you don’t repeat pages in both list when the list_pages function is called.

    Hope that makes sense.

    Wicked! Thanks for that!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Appyling different classes to navigation’ is closed to new replies.