Skip to content

Instantly share code, notes, and snippets.

@kirandash
Last active February 19, 2017 07:09
Show Gist options
  • Select an option

  • Save kirandash/ef8c169a2d40d3a4cce40191de13545b to your computer and use it in GitHub Desktop.

Select an option

Save kirandash/ef8c169a2d40d3a4cce40191de13545b to your computer and use it in GitHub Desktop.
Remove current_page_parent from posts page link in WordPress nav menu
<?php
function wpdev_nav_classes( $classes, $item ) {
if( ( is_post_type_archive( 'fleet' ) || is_singular( 'fleet' ) )
&& $item->title == 'Blog' ){
$classes = array_diff( $classes, array( 'current_page_parent' ) );
}
return $classes;
}
add_filter( 'nav_menu_css_class', 'wpdev_nav_classes', 10, 2 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment