Forums

setting a class on ul and li tags (4 posts)

  1. rondog
    Member
    Posted 2 years ago #

    Hi I am using this:
    <?php wp_list_pages('title_li='); ?>

    and it displays all my pages just fine. I need to and a custom class to the 'ul' and 'li' tags and was wondering how to do that. Thanks.

  2. Empireoflight
    Member
    Posted 2 years ago #

    html/php:

    <ul class="yourClass">
    <?php wp_list_pages('title_li='); ?>
    </ul>

    CSS:

    .yourClass li {
    /* insert rules here */
    }
  3. rondog
    Member
    Posted 2 years ago #

    Oh...I didnt realize that it wasnt adding ul tags...awesome..thanks!

    My next question is, how can I add a class to the li tags then? The reason I ask is I have a 3 tier menu and when the 2nd tier has a 3rd tier item I need to add a class to it to add a little arrow next to it.

  4. Empireoflight
    Member
    Posted 2 years ago #

    .yourClass li ul li {
    / *insert rules here */
    }

    You should be able to target nested li's as far in as you need to with this method.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.