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