So you need to real name and URL of the parent in the submenu.
You have no info about a post item in your function start_lvl()
.
But in function start_el()
you have the items and could query for it’s parent.
This needs some refactoring with putting lines like the if($display_depth > 0){
condition from start_lvl
function into your start_el
function. Then writing a proper WP query to get the Info’s of the parent item you need in the submenu.
To point a bit more specific:
In start_el
function you have the var $item
which should contain the ID of the post it represents. Should be $itemId = $item->Id
.
If so you should get the parent with $parentId = wp_get_post_parent_id( $itemId );
and further more you can fetch infos from the parent with the parent ID with some other WP functions.
Hope that helps to find your way..
Related Posts:
- Mega Menu Walker
- start_lvl Ignored in Custom walker_nav_menu
- Run a filter when a walker runs
- Automatically adding new post categories to menu
- Detecting classes, adding widgets, and adding divs in with a Nav Walker
- Add login hyperlink to secondary navigation menu
- Displaying Logged-In User Name in WordPress Menu
- Hide main div if wp_nav_menu is empty
- Check if a menu is empty?
- How to remove a metabox from menu editor page?
- Walker class: Problems with understanding how walk() method can be called without error
- Hide a menu-item and its submenus and display a ‘Log in’ link if the user is logged out
- The best way to customize “nav-menu-template.php” to add if the ‘link_before’ is “checkbox”
- How to add active class to custom menu using while loop and wp_list_pages
- WordPress menu deletes when trying to add a hook
- Logout and redirect using the WP Menu
- Have CSS Class Added with `is_page()` WP function
- Add itemprop Schema.org Markup to li Elements in wp_nav_menu
- Can’t extend some core classes
- Trouble creating conditional PHP for nav menu items with children for custom Walker
- Menu — How to add “current-menu-grand-ancestor” css class
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- WP Walker using custom css classes
- Add data attribute to each li in menu
- Custom Walker_Nav_Menu issue with variables on PHP 7.3
- Unique icons next to each WordPress menu item
- Child page menu in sidebar
- Title Case WordPress Menu Items
- WordPress Quick Question . How to Get Parent Link in Submenu in My Code
- Trying to store submenu items to render out after main menu
- How to change menu order item
- Add item to top of menu using a filter in functions.php
- Register a menu – Error Header
- New walker for walker_nav_menu to change inside container data
- Add value to new attribute inside WordPress menu items
- How to display different submenus?
- Get the name of menu item with wp_nav_menu
- How to add aria role and schema markup to custom walker container
- How can I use custom menus with a Bootstrap WordPress theme?
- Extend Menu Walker Output
- Nav-Menu not showing up
- Remove submenu item from list
- Dynamic Menu drops pages?
- Menu not styling. New menus functionality giving me a headache
- Nav Walker that shows only children and siblings of top level parent menu item
- how to changes mobile menu toggle breakpoint in WordPress
- How to display already created menus via php?
- Providin exception to WordPress wp_nav_menu Custom CSS Classes
- Adding markup to sub menu based on class
- How to put 2 php codes in functions.php without site crashing
- Menu not updating for logged in users after redirect
- Add element after navigation element title don’t works like I expect
- Difference between “Walker_Nav_menu” and “walker”
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- Pulling a variable into the wp_nav_menu function
- How I can add div to menu?
- Add the “.current-menu-item” class to tag?
- WordPress adding in site URL to header links
- Custom Links in Walker Class
- I am extending Walker_Nav_Menu: How can I get the number of children elements of the current item?
- Custom Navigation Bar JSON Syntax Error in JSON at Position 0
- How to add different menu items on different menus?
- Display additional page templates and a sidebar on plugin activation
- Adding a ‘style=’ bit to image_send_to_editor output
- Post Views Code Hacks
- Closing WP_LINK_PAGES DIV ID w/After Argmuent
- Aspx/Rss feed – failed to open stream: Redirection limit reached
- Adding an Unlinked Space in a Custom Function
- exclude custom post type from running a function
- Taxonomy term description with style, only if the description exists?
- Exclude function from running on a certain page
- Convert all uploaded PNG files to PNG-8 format
- Class for Selected Menu using wp_nav_menu
- AJAX function not working [closed]
- Migrating site, only header shows
- Customize field names in backend profile edit page through function.php [duplicate]
- Make table disappear when fields are left blank?
- Remove the Tag from wp_nav_menu
- Get date function not working
- Styling an “active” link outside of WordPress default menu
- How to create Loop code for Menu using WordPress?
- Pagination Not Working (pages duplicating content)
- Use of antispambot with $curauth->email
- Hard-coding a shortcode as the last menu item in primary navigation?
- Dynamic menu with custom post types
- Auto create Nextgen Gallery on post creation [closed]
- Uses for function: wp_update_user
- How do I call an external php non WordPress class into functions.php?
- Insert content into head tag with function
- Function to call either single post or category
- Custom functions for string data calculations
- How are these PHP functions applied to a specific page in WordPress?
- WP insert post Redirect after function has executed
- SQL error with custom query
- The additional fee for the COD payment method not visible in the front-end
- Hide media for non logged in users
- Programmatically revert to backup .htaccess a possibility?
- PHP identify duplicate words in a text string against a list of words
- How to access all meta data for RSS feed?
- Why Is Number of views on wordpress single post wrong?