How to set limit only on top levels of wp_nav_menu?

According to the codex, you just need to use depthparameter to display only top-level pages : <?php wp_nav_menu( array( ‘location’ => ‘your_location’, ‘depth’ => 1 ) ); ?> For more reference see this. You could also fix both of your problem by using [wp_get_nav_menu_items][2] and then using a custom loop to parse only first and … Read more

How to add active class on current menu item page?

You could add conditional classes for each in your child theme functions file: Here’s one example you can modify to suit your own needs. add_filter(‘nav_menu_css_class’ , ‘wpsites_nav_class’ , 10 , 2); function wpsites_nav_class($classes, $item){ if( is_archive() && $item->title == “Products”){ $classes[] = “products-class”; } return $classes; Source http://codex.wordpress.org/Function_Reference/wp_nav_menu#Adding_Conditional_Classes_to_Menu_Items You can then style your nav menu … Read more

How to custom output wp_nav_menu()

You will have to use a custom Walker for your menu. Here is the page in the codex that explains it: https://codex.wordpress.org/Class_Reference/Walker and here: https://developer.wordpress.org/reference/classes/walker_nav_menu/ Hope that helps.

Add custom attribute to menu item link using Filter

You may target the current_page_item CSS class or you may target the current-menu-item CSS class instead. current_page_item class may not be present for all kinds of menu item. Read the answer here to know why. Whichever CSS class you choose, you may use the CODE like the following to set the attribute: add_filter( ‘nav_menu_link_attributes’, ‘wpse260933_menu_atts_filter’, … Read more

wp_nav_menu() doesn’t apply correctly classes and IDs to menu and container

I believe this is caused probably by your theme or another plugin, filtering on wp_nav_menu_args and changing the items_wrap value. I tested your provided code and the output was correct, using blank WordPress 4.9.4 installation. You could try passing items_wrap with default value: wp_nav_menu( [ ‘menu’ => ‘Primary Navigation’, ‘menu_class’ => ‘this-is-the-menu-class’, ‘menu_id’ => ‘this-is-the-menu-id’, … Read more

Remove Pagination in Appearance -> Menus -> Categories

As per Stackoverflow Stackoverflow Ok after reading through the source code I found that the number of categories returned in the edit menu section is hardcoded to 50 on line 613 of \wp-admin\includes\nav-menu.php // Paginate browsing for large numbers of objects. $per_page = 50; $pagenum = isset( $_REQUEST[$taxonomy_name . ‘-tab’] ) && isset( $_REQUEST[‘paged’] ) … Read more

Multi Level Bootstrap Navigation Menu in WordPress

Here some thing interesting for you STEP 1 add a script to header like below ( it’s always better go for the enqueue method . i need some one to help me with properly adding the below script in WordPress way .jquery should run before the second script> <script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js” type=”text/javascript”></script> <script> $(document).ready(function () { … Read more

Attaching a navigation menu to the admin bar?

It turns out to be very easy! No need for a special walker, wp_get_nav_menu_items() returns everything you need. This example adds an single root menu item and then the menu, you can do this differently if you want. It maps all extra menu features I could find in the code, I don’t know whether you … Read more

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