Add parent link to its submenu
Add parent link to its submenu
Add parent link to its submenu
On the WP Dashboard, navigate to: Posts => Categories Create new Category, name it – Products. Then go to your post/product-a, on the right panel search for categories and add the new category Products to the post/product. Save it or Update the post, refresh the page, now if you check the url for this post, … Read more
The menu data is in the database. In order to have an exact copy, you need to copy the files and all the items in the database as well. Verify if all the needed elements from the database are present in the wordpress admin and or with phpmyadmin. Alternatively, after these lines in your PHP … Read more
I had to compare the $object_id with the current queried object id instead of the post id. https://www.robbertvermeulen.com/wp_get_nav_menu_items-current-menu-item/ $object_id = get_post_meta( $id, ‘_menu_item_object_id’, true ); $current = ( $object_id == get_queried_object_id() ) ? ‘current-menu-item’ : ”;
Please try something yourself. Stack Overflow is not like other websites in terms of “other people do my work”.
The code above is correct and includes the answer. I’ve added a function with a genesis hook to enwrap it so it should just work with copy-past.
You can just use wp_get_nav_menu_items( $menu, $args ); to get list of menu items created in appearance. You can print result the way you want. Before printing just make sure the datas are not empty and so. I didn’t add any validation. So use according to your need. For example: We’ll try to print the … Read more
The code for this will be: <?php if ( is_user_logged_in() ) {wp_nav_menu()} ?> You can read more on menus here and more on is_user_logged_in here
I might be misunderstanding you, but why not use wp_create_nav_menu()? E.g., this is what I do to create a custom BuddyPress menu when I detect BP as active: $menuname = $lblg_themename . ‘ BuddyPress Menu’; $bpmenulocation = ‘lblgbpmenu’; // Does the menu exist already? $menu_exists = wp_get_nav_menu_object( $menuname ); // If it doesn’t exist, let’s … Read more
How to know which menu trigger a link?