Created
April 19, 2015 07:37
-
-
Save generatepress/7752e14657e806b63473 to your computer and use it in GitHub Desktop.
Possible fix for blog menu current highlighting with other post types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('nav_menu_css_class', 'generate_cpt_active_menu', 400); | |
function generate_cpt_active_menu($menu) { | |
$post_type = get_post_type(); | |
switch($post_type) { | |
// Replace gallery with the name of your custom post type | |
case 'gallery': | |
$menu = str_replace('current-menu-item', '', $menu); | |
$menu = str_replace('current_page_item', '', $menu); | |
break; | |
} | |
return $menu; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment