How to add bubble count in WordPress wp_nav_menu menu?

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.

different Menu position showing same menu

I can see a syntax error: replace ‘theme-location’ by ‘theme_location’. Always think about underscores in WordPress variables/functions names 😉 wp_nav_menu() : https://codex.wordpress.org/Function_Reference/wp_nav_menu

Manipulating menu HTML

Use a custom walker. Extend the functions start_lvl() and end_lvl(): class WPSE39005_Div_Walker extends Walker_Nav_Menu { /** * @see Walker::start_lvl() * * @param string $output Passed by reference. Used to append additional content. * @return void */ public function start_lvl( &$output, $depth ) { $output .= ‘<div><ul class=”sub-menu”>’; } /** * @see Walker::end_lvl() * * @param … Read more

Add items to a menu dynamically

You could achieve this with a custom walker function, on your menu. a very simple example: class Walker_WPA82563_Submenu extends Walker_Nav_Menu { function end_el(&$output, $item, $depth=0, $args=array()) { if( ‘Boats’ == $item->title ){ $output .= ‘<ul><li>Dynamic Subnav</li></ul>’; } $output .= “</li>\n”; } } Then where you call the nav menu, create an instance of your custom … Read more

Get menu links only

Use a custom walker: class WPSE_33175_Simple_Walker extends Walker { public function walk( $elements, $max_depth ) { $list = array (); foreach ( $elements as $item ) $list[] = “<a href=”https://wordpress.stackexchange.com/questions/33175/$item->url”>$item->title</a>”; return join( “\n”, $list ); } } … and then call wp_nav_menu() like this: wp_nav_menu( array ( ‘theme_location’ => ‘your_registered_theme_location’, ‘walker’ => new WPSE_33175_Simple_Walker, ‘items_wrap’ … Read more

Bar separated navigation by extending Walker_Nav_Menu

You can use the menu order inside the item to see if it’s not first. If it isn’t have it draw the character before the anchor. class Bar_List_Walker_Nav_Menu extends Walker_Nav_Menu { private $separator = ” | “; function start_el(&$output, $item, $depth, $args) { if($item->menu_order > 1){ $output .= $this->separator; } $attributes = ! empty( $item->target … Read more

How can I disable parent menu item links?

Do not create fake URLs (#). This would be very bad for users with a screen reader: the are using a list of available links to browse your site. The same is true for javascript: links, they are not exactly elegant markup anyway. You need two steps: Mark the items with children before the walker … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)