Yes, if you want to keep using a WP nav menu, a walker is the right way to go.
To only affect a certain level (i.e. children, grandchildren, parent, etc.) you can use $depth
.
class wpseWalker extends Walker_Nav_Menu {
public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
// Check $depth - if it's 0 it's the top parent, 1 is a direct child
if($depth == 1) {
// Just temporarily, show all the item's properties
// You'll want to grab the ID from here and pull the ACF data
$output .= print_r($item, true);
}
}
}
You’ll also want to check and make sure the ACF data exists, in case someone sets up a menu item that doesn’t have that info.
Related Posts:
- Nav Menu – Add class based on meta keys
- Override edit_custom_walker.php to conditionally show input depending on menu position
- Advanced Custom Fields: how do I check to see if a value is set in an field? [closed]
- How to add a custom field in the advanced menu properties?
- Custom Nav walker display current menu item children, or siblings on no children
- Adding a custom field to the site identity menu
- Advanced Custom Fields – Get custom fields from parent page
- Add custom field to the archive page?
- Matching Serialized Arrays with meta_query
- Display post_object content using Advanced Custom Fields plugin
- Remove old custom field after import
- Unable to get Preview of Uploaded image within a Custom Meta box
- Retrieve custom fields on Categories, using WP-API
- Add meta data to the menu
- Order by custom field date?
- Change content before writing to database
- Order Custom post type loop by custom field (datepicker)
- Dynamic User State & City selection
- Using Custom Function With Advanced Custom Fields
- automatically set “Featured Image” the same as the og:i that is set in a custom field
- Displaying Custom Fields on Post with Genesis Child Theme
- Unable to show ACF’s Image Custom Field properly in Genesis Framework [closed]
- Login & Register & Custom details WITHOUT plugin
- Send Multiple Custom Field Values Through the URL
- Update posts after populating ACF field value [closed]
- How can I pass a variable set by ACF to header.php?
- WP Custom Fields Metabox Disappears – ACF plugin issue [closed]
- Transfer self made functions.php custom fields to Advanced Custom Fields [closed]
- Creating a custom menu/widget area
- Will loading too many ACF Fields cause slow down?
- Calling the “wp-link-wrap” pop-up modal
- Print custom field in Query Loop block
- How to schedule a custom field value update?
- Order RSS content by an advanced custom field value
- Add new image block, set default class name and update it using Javascript
- Add image to menu item with ACF
- Get an advanced custom field after post publish
- How to create a dropdown select of all items in an ACF field group
- WooCommerce – Adding Custom Fields To Invoice
- Declaring in variables [closed]
- Sort custom post type by multiple custom fields
- How to add a custom field in the advanced menu properties?
- Redirect to another page using contact form 7? [closed]
- Advanced Custom Fields WYSIWYG More tag
- How to list Category list in ACF Pro’s Select Field to choose from [closed]
- Custom fields issue [closed]
- Querying posts by latitude and longitude to build a Google Maps with several markers
- How to copy data from a custom field to the post_content?
- WordPress creates new lines in postmeta table on post update
- ul list with only as many li’s as filled custom fields
- Display custom field from the front page on another page
- How to Pass values to Custom Field through PHP in WordPress Posts?
- Filter posts by custom field (Advanced Custom Fields)
- Advanced Custom fields not available yet during publish_page action
- How can I output the custom fields wrapping with HTML
- Displaying an ACF list of users
- The conditional logic only works to show or hide?
- ACF Plugin How to make the customer add more fields in the post?
- How to get custom image field of specific post id
- Populate wordpress menu with link to custom field value (file download)
- How To Save Data From Remote APIs To ACF?
- comments_where Hook
- Rewrite comment form post ID on submit
- What am I missing in this Code Block?
- How to show ACF fields in Gridbuilder custom block
- get_field values for each post on home page using wp_add_inline_style
- Problem with revisions only returning four results
- How to set up page fields with gutenberg instead of ACF
- Shortcode for Custom Field of Media Attachment (to use with Featured Images)
- ACF multi taxonomy on filterable gallery
- Is there any way to make a custom field for a post only if the author is a certain user?
- How to use ACF with javascript to update custom field values?
- wordpress custom menu – show parents, siblings, children depending on depth
- Menu walker: how to tell if a sub menu contains submenus?
- Show Custom field value instead of title in WP Menu
- How to make menu country specific?
- adding autosave feature to custom fields
- Retrive acf fields in publish_post action for wp_mail
- Getting user’s data, by custom field lookup (meta)
- How to delete attachments associated with custom field type when post property changes? [closed]
- Counting number of images from loop
- Page template is missing fields or is invalid when I updating the template
- Advanced Custom Fields from Category – IF statement
- How to check custom fields from functions.php
- Query Posts based on custom field value
- display Flexible Fields from options
- Display Child Page with custom fields within Parent Page
- WordPress taxonomy child image
- Filter and display a specific custom field value [closed]
- Query Posts Via WordPress URL
- How to Order Posts by Custom Fields?
- I want to add a custom field in the rss title of each post, but don’t want it to be shown on the site
- Update field name without losing the value
- Adding custom field to an array
- How to get all specific fields from one ACF Group?
- Truncating characters in Advanced Custom Fields works some places but not others?
- save all acf options in one meta_value [closed]
- Conditional display based on ACF checkbox
- acf field repeater link don’t work
- How to add an ACF only for parent term?