WordPress.org

Ready to get started?Download WordPress

Forums

Child Page Navigation
CSS class in currently selected page (4 posts)

  1. aicos
    Member
    Posted 1 year ago #

    Hi awesome plugin. Exactly what I need... almost.

    The only thing its missing is a CSS class in the currently LI element for the current page (just like in the standard wp navigation menu). That way I can highlight what child page the visitor is currently viewing.

    Thanks!

    http://wordpress.org/extend/plugins/child-page-navigation/

  2. Beshoy Girgis
    Member
    Posted 10 months ago #

    This is doable by modifying line 80 of child-page-navigation.php

    from:

    echo "

  3. ID)."'>".get_the_title($page->ID)."
  4. ";

    to:

    echo "

  5. ID)."'" . ($page->ID == $post->ID ? " class='curent-page'" : '') . ">".get_the_title($page->ID)."
  6. ";

  • Beshoy Girgis
    Member
    Posted 10 months ago #

    Wow... by the looks of it, I broke wordpress.org's forum lol...

  • Beshoy Girgis
    Member
    Posted 10 months ago #

    Take 2:

    This is doable by modifying line 80 of child-page-navigation.php

    from:

    echo "<li><a href='".get_permalink($page->ID)."'>".get_the_title($page->ID)."</a></li>";

    to:

    echo "<li><a href='".get_permalink($page->ID)."'" . ($page->ID == $post->ID ? " class='current-page'" : '') . ">".get_the_title($page->ID)."</a></li>";

  • Topic Closed

    This topic has been closed to new replies.

    About this Plugin

    About this Topic

    Tags

    No tags yet.