Home › Forums › Front-end Issues › How to display a nav menu field without wp_nav_menu(); › Reply To: How to display a nav menu field without wp_nav_menu();
Try one of these examples:
To get both field
and menu
<?php
$id = '' //(string) (required) Menu 'id','name' or 'slug'
$menu = wp_get_nav_menu_object( $id );
$field = get_field('field_name', $menu);
To get only the field
:
<?php
// WP < 4.4
$post_id = 'nav_menu_1' //the number must be the menu ID
// WP >= 4.4
$post_id = 'term_1' //the number must be the menu ID
$field = get_field('field_name', $post_id);
EDIT: Different calls for WP Versions
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.