WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Appyling different classes to navigation (5 posts)

  1. staceyk18
    Member
    Posted 5 years ago #

    Hi!

    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!!

    Stace

  2. educationthemes
    Member
    Posted 5 years ago #

    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.

  3. staceyk18
    Member
    Posted 5 years ago #

    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.

    Thanks!

  4. educationthemes
    Member
    Posted 5 years ago #

    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.

  5. staceyk18
    Member
    Posted 5 years ago #

    Wicked! Thanks for that!

Topic Closed

This topic has been closed to new replies.

About this Topic