Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ADICIONA CLASSE CURRENT PARA OS SINGLES DO CPT NO MENU - ADICIONE NO FUNCTIONS.PHP
- add_filter('nav_menu_css_class', 'current_type_nav_class', 10, 2 );
- function current_type_nav_class($classes, $item) {
- $post_type = get_post_type();
- if ($item->attr_title != '' && $item->attr_title == $post_type) {
- array_push($classes, 'current-menu-item');
- };
- return $classes;
- }
- /* No painel do menu acrescente um link personalizado para a página do CPT - archive-cpt.php - e coloque o nome do CPT no atributo do título. A função acima utiliza o atributo do título para adicionar a classe "current". */
Advertisement
Add Comment
Please, Sign In to add comment