Insert the post ID in the_field
function. See the documentation.
<?php the_field($field_name, $post_id); ?>
$field_name
: the name of the field to be retrieved. eg “page_content” (required)$post_id
: Specific post ID where your value was entered. Defaults to current post ID (not required). This can also be options / taxonomies / users / etc
So in your case use the_field('tour_length', $item->ID)
to retrieve the correct data for the specific post.
Related Posts:
- ACF loops false value with repeater and checkbox
- ACF Repeater loops and resets – where is the reset_rows() documentation? [closed]
- Endless loop with wp_insert_post and wp_update_post
- Add Incrementing ID to each paragraph in the_content
- List events by month
- Remove comma from last item output from loop
- post__in – Placing content from a foreach loop inside of an array
- In a foreach loop, how do I target the last item in the loop?
- How to iterate through database until it find a match
- the_content() seems to block my ACF-code
- Advanced Custom Fields: Post Object – Not returning data [closed]
- How can I add multiple ‘tax_query’ arrays via a loop?
- ACF page while loop breaks footer while loop
- Using Advanced Custom Fields to create a per page slider
- How do I go about looping through a advanced custom field on a particular page inside of another page
- Using an ACF field from a page within a post loop?
- Get all posts including sticky ones with get_posts(),setup_postdata(), and foreach loop?
- How to print out menu names in the foreach loop?
- Stuck in the query loop
- ACF custom field in [closed]
- Add class to last 3 posts in loop
- Distribute Gallery Images Every nth in Loop
- ACF – add a group inside a repeater [closed]
- Output meta into arrays
- While loop with bootstrap [closed]
- Need to add class to first element in a foreach loop
- Foreach displays from last to first
- How to create a multidimensional array with multiple loops
- Simple foreach loop help needed in wordpress “the loop”
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- Loop through ACF taxonomies and output associated posts
- How to print redux gallery feilds id? [closed]
- Blank content php code not parsing advanced custom fields gallery add-on [closed]
- How to check all items in a loop have post thumbnail?
- Fetch data from two custom post types and create multidimensional array for output to html table
- ACF: display custom filed of CPT into the loop
- Use ACF Category Image for all Taxonomy Archive Views
- Need to while loop and display contents in the subfield of a group field given by ACF
- ACF – Get ID of relationship field in flexible content
- Add Search and Filter functionality to custom loop
- How to output values from a loop into a javascript array
- ACF background-color per post in a WordPress loop
- PHP for loop not working as intended
- Display related post content and custom field content
- Get featured image outside the loop using foreach
- Why loop renders only last metabox from array? [closed]
- Foundation modal in wordpress php loop
- ACF loop and php formatting
- Can’t see custom field after the Loop [closed]
- the_post_thumbnail unless video id is added
- Eliminate duplicates in a foreach loop [closed]
- While loop inside another while loop
- Wrap every 2 divs in row – for each loop [closed]
- remove post that has no content
- Display Authors in a grid loop
- trouble calling an import class from an action in a plugin before wp_cron executes
- How to fix pagination for custom loops?
- Display category name only once inside loop
- Infinite Scroll and DFP
- Two loops on different pages do the same thing, but only one page works
- Posts active and expired in different loops
- angularjs not displaying all posts
- The loop seems stuck to a single (now deleted) post
- Blog page Server error 500 with stick post loop in query.php
- Can’t find infinite loop cause
- Blog’s post count cause irratic behavior
- Checking array against author id in loop
- How do I Turn This Into An if statement?
- pre_get_posts for two loops on same page
- How to update post meta on uploaded image from a custom form?
- Ajax Button to load more Posts into a timeline
- Sanitize Custom Field Value in Meta Query
- Default ‘post’ post type archive slug?
- How to target thumbnails of the first post in the loop
- show random image in loop if image is not set
- How do I style the first two posts of a loop
- Get Page content to displayin Bootstrap Modal
- WordPress Rewriting the DOM?
- How can I paginate this?
- Get all fields inlcuding “ACF” (Advanced Custom Fields) columns in wp_query
- Obtain page data and use regular loop
- How to display posts by vote count and if no value continue with latest posts with no votes?
- How can I load posts starting from, and including, the current post?
- Load wordpress content in other domain
- Genesis multiple category custom loop 404s after first page
- Custom Loop Using Shortcode in Custom Page Template
- Do I need to use The Loop on pages?
- Sort results by groups of numbers and letters
- Listing subpages title and content and styling the first iteration differently
- Infinite Scroll on a loop?
- Shortcode in posts called by ajax is not working
- How Can I use WP_Query to Only Display 1 Post from Custom Post Type if Query Returns Posts with Matching ID in Custom Field
- How to fix pagination for custom loops?
- Modify the main loop to display current month / year
- Show all posts using the template page and the loop?
- Checkbox doesn’t stay checked, conten
- Showing sticky posts with get_posts()
- Pagination – works on local but not live dev!
- On single.php, fetch 2 posts created after and 2 posts created before in relation to the actual post (using menu_order)
- query_posts() vs get_posts() multiple loops [duplicate]