WordPress.org

Ready to get started?Download WordPress

Forums

highlighting selected page in wordpress (2 posts)

  1. CreativeWP
    Member
    Posted 2 years ago #

    I must place a highlight when a page is selected in this menu. I just can't figure out how! I have tried several things. Below is the code for my nav, the second code is the one I was trying to incorporate in to the nav to make the highlight work. BUT it didn't. Any help?

    <ul>
        <?php wp_list_pages( array('title_li'=>'','include'=>get_post_top_ancestor_id()) ); ?>
        <?php wp_list_pages( array('title_li'=>'','depth'=>2,'child_of'=>get_post_top_ancestor_id()) ); ?>
    </ul>

    <?php if ( is_page() { echo ' class="current_page_item"'; } ?>

  2. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    http://codex.wordpress.org/Function_Reference/wp_list_pages#Markup_and_styling_of_page_items

    wp_list_pages() should in theory do this automatically, unless the original query is messed up by some custom query before the call of the function.

Topic Closed

This topic has been closed to new replies.

About this Topic