Set Item Order with wp_nav_menu_{$menu->slug}_items

you can always search & replace by string or regex the output html of the filtered $items. anyway, if you’re targeting usual menu items, you can add $post objects and order items through the wp_nav_menu_objects filter, otherwise here’s the basic sample code: function replace_itemcart_in_menu( $items, $args ) { $url = home_url(‘my-item’); $previtem = ‘<li id=”menu-item-11″ … Read more

Wrap description and sub menu in a wrapper

Ended up doing via jquery jQuery(‘.menu-item-has-children’).each(function(){ idLi=jQuery(this).attr(‘id’); jQuery(‘#’+idLi+’ ul’).wrapAll(‘<div class=”slideFromtop”>’) });

Generate a tabbed submenu — from taxonomy term or submenu item — with sample content

I ended up solving this problem with Ubermenu. What I wanted to write was complex enough that it made more sense to get a tested, commercial plugin that had the features I need. MaxMegaMenu didn’t do tabbed content but Ubermenu does. I’m able to construct menus like this: Taxonomy1 [Tabs] [DynamicTerms] [Dynamic Posts] Taxonomy2 [Tabs] … Read more

Add div to specific sub-menu

The WordPress native Walker class doesn’t pass the arguments you need to the start_lvl() method. So to do this, you will need to add a custom display_element() method to your custom walker. You can use most of the original, with something similar to the commented section below: public function display_element( $element, &$children_elements, $max_depth, $depth, $args, … Read more

Add Menu items description via Custom Walker for wp_nav_menu()?

I have used custom nav walker for showing descriptions in one of my project. i am sharing the code here so it might help you to solve your issue. class annframe_description_walker extends Walker_Nav_Menu { function start_el(&$output, $item, $depth, $args) { global $wp_query; $indent = ( $depth ) ? str_repeat( “\t”, $depth ) : ”; $class_names … Read more

Replacing the NavWalker dropdown element

You need to replace the end_lvl method of Walker_Nav_Menu as well. This is what you would need to add: public function end_lvl( &$output, $depth = 0, $args = array() ) { if ( isset( $args->item_spacing ) && ‘discard’ === $args->item_spacing ) { $t=””; $n = ”; } else { $t = “\t”; $n = “\n”; … Read more

Displaying wp menus by name without using theme locations

Umm u can do that easily. And this is the way I do how i register my menu in functions.php add_action(‘init’, ‘register_custom_menu’); function register_custom_menu() { register_nav_menu(‘custom_menu’, __(‘Custom Menu’)); } Then in ur admin panel u create different menu by ur desired name. And get the menu where ever u want like this. EX:- if I … Read more

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