highlighting selected page in wordpress (2 posts)

  1. CreativeWP
    Posted 3 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?

        <?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()) ); ?>

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

  2. Michael
    Forum Moderator
    Posted 3 years ago #


    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