Parent link need to go first child submenu

I found solution here Create template for parent pages: <?php /* Template Name: Redirect To First Child */ if ( have_posts() ) { while ( have_posts() ) { the_post(); $pagekids = get_pages( “child_of=” . $post->ID . “&sort_column=menu_order” ); $firstchild = $pagekids[0]; wp_redirect( get_permalink( $firstchild->ID ) ); } } ?>

Extending Walker_Nav_Menu in wp_nav_menu List of Empty Items

The answer was that the theme location is primary_navigation with an underscore, not primary-navigation with a hyphen. I’m not sure why it seemed to work without the walker argument. Typical and along the lines of what it seemed like must be the solution. The obvious thing I wasn’t seeing because of feeling overwhelmed by an … Read more

how do you create this customize menu using wp_nav_menu function?

You can to pass class into function arguments: ‘menu_class’ (string) CSS class to use for the ul element which forms the menu. Default ‘menu’. So you can try this: <?php $args = array( ‘menu_class’ => ‘nav header-nav header-bottom-nav nav-center nav- uppercase’, ‘menu’ => ‘(your_menu_id)’ ); wp_nav_menu( $args ); ?> You can read about WordPress Menus. … Read more

How to append something before final tag in walker class?

You should check the $depth argument to make sure the search form only appears at a certain depth/level, e.g. if( 0 === $depth ) { … } I personally would place the search form outside the <ul> though as I don’t think it’s valid HTML. It would hurt your site’s accessibility. Alternatively, wrap it in … 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

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

Custom Walker menu depth opening problem

I Try to find how to collapse all cat by default in other word In that case, then try this script (replace the one you have now): <script> ( function ( $ ) { $( ‘li.has-children’, ‘#cat-drop-stack’ ).on( ‘click’, ‘> a span.caret-icon’, function ( e ) { e.preventDefault(); var self = $( this ), submenu … Read more

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