Installing compact search in the main menu?

You can create a menu item for search icon/button and check it’s ID in HTML code. Then use can use jQuery click function to show and hide search div. For example if my menu item list (li) id is menu-item-22 and search form container class is search_div then this will be the jQuery for displaying/hiding … Read more

menu is only pulling in one item

This sounds suspiciously like the conflict that happens sometimes when tag taxonomies, custom post types, and menus collide in a weird way. I have only found hacks for this issue, and many of them are listed in this thread on WordPress.org.

Menu Button that link to different pages for unique user?

If you want to do something like a “Back to previous page”-link that will probably not work with the WP menu system. But you could modify/add your theme and use $_SERVER[‘HTTP_REFERER’] (PHP manual) to link back to the site, where the user clicked the link to the actual page. But that information can also be … Read more

How to select single category in menu if post have two categories?

Yes, Finally i had done it. I done changes in nav-menu-template.php. I created one variable and initialized with 1 above foreach ( (array) $menu_items as $key => $parent_item ) { this code. and add conditional code if($repetation == ‘1’){//to stop second selection of menu $classes[] = ‘current-menu-parent’; $menu_items[$key]->current_item_parent = true; $repetation++; } else{ //echo $repetation; … Read more

Show Child of Parent Page including all other parents

‘depth’=>-1 will show all the levels (source^): $depth (integer) (optional) How many levels of the hierarchy are to be included where 0 means all. -1 displays links at any depth and arranges them in a single, flat list. Default: 0 So your code will be: <?php if (has_nav_menu( ‘secondary’ )) { wp_nav_menu( array( ‘container’ => … Read more

Update nav menu not selecting parent

As I originally suspected, menu-item-parent-id takes the id of the menu item and not the id of the parent page. So I referenced the menu item ID and passed it into the recursive function : function buildMenu( $array, $menu_id, $parent_id = false ) { foreach ($array as $menu) { $menuItemId = wp_update_nav_menu_item( $menu_id, 0, array( … Read more

Can’t add any menu items anymore, server related

While it is a guess, rather than certainty, the issues with menus typically boil down to following — working with them involves submitting large and complicated POST requests to server. And what on server has issue with large and complicated POST requests? Security software! The first item to check in such case is usually going … Read more

Hide menu theme location for certain capabilities?

Check user capabilities or roles when registering the navigation menu. The data will remain accessible via wp_nav_menu, but users without the capabilities won’t see the location in Appearance -> Menu -> Manage locations. Note this will only prevent assigning menus to these locations. Any menu assigned to the location already will be manageable (if the … Read more