Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End is-current class not applying to single WordPress post

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #163026
    Josh Johnson
    Participant

    If you go to http://dev.joshuajohnson.co.uk/ – the “is-current” class is added to the respective pages <li>. On a single post however the class is not added.

    Any ideas why this is happening?

    #163028
    Josh Johnson
    Participant

    Solved using this function:

    function my_special_nav_class( $classes, $item ){
     if( is_single() && $item->title == 'Blog' )
        {
            $classes[] = 'is-current';
        }
        return $classes;
    }
    add_filter( 'nav_menu_css_class', 'my_special_nav_class', 10, 2 );
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.