WordPress menu walker – help to add custom class for each submenu

You’re right, it’s the object-oriented parts that are throwing you off. The nav menu call should be: wp_nav_menu(array( ‘theme_location’ => ‘menu-top’, ‘container’ => ‘ul’, ‘menu_class’ => ‘header_nav_ul’, ‘menu_id’ => ‘header_nav_id’, ‘depth’ => 0, ‘walker’ => new my_walker_nav_menu_start_el, )); no parentheses () after the name of the walker. The walker itself needs to extend Core’s Walker_Nav_Menu, … Read more

Adding markup to sub menu based on class

Here is your code <script> $(document).ready(function(){ $( “.product-menu .sub-menu-level-1” ).after( “<div>SHOW ONCE</div>” ); }); </script> This will automatically add the div if the parent has a class name of product-menu. Let me know if I miss something. and if this solved your issue, give a thumb

How to include second layer sub menu to Walker Nav?

Without testing & debugging your example I’m not 100% certain what’s going wrong. I noticed your walker doesn’t have a end_lvl method which would be my first guess as to why dropdowns past the first level won’t work. Here’s a copy of a Nav Walker that I’m certain handles nested nav menus well. You’ll want … Read more

Add attributes to wrapper html generated by wp_nav_menu

Modifying the wrapper for the wp_nav_menu() is customizable with the items_wrap parameter. https://developer.wordpress.org/reference/functions/wp_nav_menu/ The documentation states that the default wrapper is a <ul> element with an ID an CLASS attribute. This can be modified as you wish by modifying the markup passed to the sprintf() function used by wp_nav_menu(). The value for items_wrap is the … Read more

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