Incorrect Behavior on WordPress Main Menu

I think you forgot to set the menu location. Below the menu (depending on the used theme) – right below that what your image shows are one or more checkboxes “Location in the theme”. Select the “primary” menu If no menu location is selected, the fallback is to show every page in hierarchical order from … Read more

How to remove a sub-menu using walker hooks/filters without relying on a custom walker?

best and easy way to hide submenu is to use css .sub-menu { display: none !important; } Or you can use ‘depth’=>1 `wp_nav_menu( array( ‘menu_id’=>’nav’, ‘theme_location’=>’header-menu’ , ‘depth’ => 1) ); or create a function to set the ‘depth’=>1 for a perticular menu. place this code in your theme function.php add_filter( ‘wp_nav_menu_args’, ‘remove_my_header_dropdown’, 1, 1 … Read more

Create a menu item with a blank title

It took me forever to find a solution to this. I thought I would release my code here for anyone that needs an answer to this question. I had to use two functions in order to solve the problem. The first function replaces the blank label with   to prevent the deletion of the menu … Read more

WordPress Accessible Keyboard Menus

With that structure, try this: (note this makes assumptions about your base styles) // your working styles, trimmed down #menu-main-navigation li > ul.sub-menu { display: none; } #menu-main-navigation li:hover > ul.sub-menu { display: block; } // focus is on the link, not the li! #menu-main-navigation li a:focus + ul.sub-menu { display: block; }

Getting parent object_id of child menu items in WordPress menu

I made 2 mistakes in my comment. try rather this code function data_attribs_menu( $atts, $item, $args ) { // check if ACF exists if( class_exists(‘acf’) ) { $page_section = get_field( ‘page_section’, $item->object_id ); if( $args->theme_location == ‘header-menu’ ) { if( $item->menu_item_parent == 0 ) { $atts[‘data-color’] = $page_section; } else { $parentItem = get_post($item->menu_item_parent); $parent_page_section … Read more

Output existing wp_nav_menu with a custom walker

By default wp_nav_menu() outputs the navigation markup. If you want to store it or want to concatenate it with other string then you’d have to set the echo parameter to false (by default it’s true). $output .= ‘<ul class=”sub-menu”> ‘ . wp_nav_menu( array( ‘theme_location’ => ‘col_1’, ‘menu_id’ => ‘col_1’, ‘menu_class’ => ‘col_1’, ‘container’ => ”, … Read more

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