Tag Info

Hot answers tagged


For flexibility, you could assign the CSS bubblecount class to the corresponding menu item: and then target it with: if( in_array( 'bubblecount', (array) $item->classes ) ) $output .= '<span class="unread">'.my_function_here().'</span>'; in your code snippet above.


Use the has_nav_menu to detect if the menu is configure in a body_class filter. Something like add_filter( 'body_class', 'wpse209469_body_class' ); function wpse209469_body_class( $classes ) { if (has_nav_menu('primary-menu')) $classes[] = 'primary-menu'; return $classes; } If you have two menus you can change the condition to match ...


Assuming that your html is outputted by a wordpress menu sitting in a sidebar, you have to extend the Walker_Nav_Menu Class which is used by menu template functions like wp_nav_menu. As stated in the reference of wp_nav_menu, you could modify its output like: class My_DataId_Walker_Nav_Menu extends Walker_Nav_Menu { // other code found in original ...


The wp_get_archives function will generate a list of links to date archives.


To be able to change the Link, you can hook into the nav_menu_link_attributes filter. if ( ! function_exists( 'wpse_209457_nav_menu_link_attributes' ) ) { function wpse_209457_nav_menu_link_attributes( $atts, $item, $args ) { if ( 'primary-menu' == $args->theme_location ) { // Get the target posts slug $object_data = ...

Only top voted, non community-wiki answers of a minimum length are eligible