WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] List Pages + add style if item is current page (3 posts)

  1. pshero
    Member
    Posted 4 years ago #

    Hey Gang,

    I'm trying to pull a list of pages under a parent page (these are pages not posts) and in that list, I need to check to see if the page is the current one, and if so, add a class="current" line to the List Item

    So I imagine if the parent page ID was 38 we'd start like this:

    <?php
      wp_list_pages( 'title_li=&child_of='.'38' );
    ?>

    but I'm clueless as to how to add the class if the page id is the page we're on. I'm sure this isn't as complicated as I'm trying to make it, but I'm a designer, not a php guy.

    Any help is GREATLY appreciated!

  2. MichaelH
    Member
    Posted 4 years ago #

    I believe Markup and styling of page items may help you.

  3. pshero
    Member
    Posted 4 years ago #

    Thanks for the quick reply MichaelH! That was exactly what I needed to know. I had no idea wp_list_pages actually assigns a current class automatically.

Topic Closed

This topic has been closed to new replies.

About this Topic