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]
- Using the Loop to show all levels of subpages under a parent page? Halfway there
- Cleanest Way to Select Every Second Element in a Loop?
- Get post by page name or slug
- If Custom Field is empty don’t display div
- Why do themes have `while( have_posts() )` in templates like single.php?
- What is best way passing variables to theme templates and using them different places like widgets?
- Display only text to WordPress loop without loosing the text formatting
- pop-up lighbox with AJAX
- WordPress Loop – Style rows of posts differently
- Link users to a custom post type
- multiple if statements [closed]
- taxonomy tags 404 to custom post types
- How does the ternary operator work in the wordpress loop post?
- Unable to write multiple values back to ACF user field – PHP
- How to set variable, pass it to a partial file and remove it after?
- How to update post meta on uploaded image from a custom form?
- Sort by page information by Ascending Numbers
- How to get the role id from the role name?
- Post loop count is not in order
- How to make posts unqueryable/unpublish posts where ACF relationship field is an unpublished post? [closed]
- Show scheduled posts in loop (but don’t link to them)?
- How to get a count of all posts in foreach loop and split into fourths
- Issue with custom loop in Archive page
- Accessing values from ACF sub field (flexible content area) in PHP
- Creating an image from a custom field
- home.php show blog posts as grid view
- Getting posts link in WordPress
- List all anchor links on a page
- Can’t get the previous and next posts permalink
- Adding first and last classes to three column layout in Bones boilerplate
- Modifying a Loop to Show More
- Does search.php autofilter The Loop?
- Defining ‘last’ class on foreach blog posts
- Add 2 values to post__not_in
- Display Post Title From Select Choice Loop in Advanced Custom Fields (ACF) – WordPress
- How to create a category loop on my blog (ACF Plugin)
- Make sticky post with FacetWP
- Adding pagination to WP_Query [duplicate]
- Insert/sticky multiple posts in multiple positions
- Transient Loop Not working as expected
- Stuck with conflicting loops on page template
- Change the way wordpress outputs images or image galleries
- How to get current page id and compare it to looped pages inside the same page?
- Show amount of posts created today above loop?
- How to create WordPress loop with combination of 4 and 2 columns twitter-bootstrap?
- posts_nav_link() not working on index.php
- Show button in header when product custom field is not empty