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

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