WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Highlight current page in List of childpages (3 posts)

  1. rezer5
    Member
    Posted 1 year ago #

    Hello, i found a codesnippet which was the one i was looking for. It lists the childpages of the current motherpage.

    <?php if ( is_page() ) { ?>
    <?php
    if($post->post_parent)
    $children = wp_list_pages('title_li=&child_of='.$post->post_parent.'&echo=0'); else
    $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
    if ($children) { ?>
    
    <ul>
    <?php echo $children; ?>
    </ul>
    <?php } } ?>

    But one thing is missing. It doesnt highlights the current page. Can anybody help me to resolve the problem?!? I've tried to fix it, but i dont know how :-( .

    Greetings rezer

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    please post a link to your site, to the page with the problem.

    generally, 'wp_list_pages()' does output the css class .current_page_item for the current page: http://codex.wordpress.org/Function_Reference/wp_list_pages#Menu_Item_CSS_Classes

  3. rezer5
    Member
    Posted 1 year ago #

    haha, ok i found it!! That was more easy than i thought :-)

    Thanks a lot

Topic Closed

This topic has been closed to new replies.

About this Topic