I am running a loop using a custom post type named WHITEBOARD - within whiteboard I have a post object field of project_select - this references a different custom post type named PROJECTS. In my code for job_# I actually want that coming from the PROJECTS post type - it returns nothing at the moment, because it is looping in the whiteboard post type.
I tried using the default ACF post object code to pull this data, but because it also uses wp_reset_postdata - the rest of the field fail to display.
How can I get the job_# field to display from a different post type (projects)?
Code:
<?php $args = array('post_type' => 'whiteboard', 'author' => $current_user->ID, 'orderby' => 'post_date', 'order' => 'ASC', 'posts_per_page' => -1 ); $myposts = get_posts( $args ); foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
<tr class="wb-content">
<td><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></td>
<td><?php the_field('job_#'); ?></td>
<td><?php the_field('site_meeting'); ?></td>
<td><?php the_field('client_meeting'); ?></td>
<td><?php the_field('request_for_quote'); ?></td>
<td><?php the_field('authority_to_proceed'); ?></td>
<td><?php the_field('final_quote_acceptance'); ?></td>
<td><?php the_field('draft_contracts'); ?></td>
<td><?php the_field('final_contracts'); ?></td>
<td><?php the_field('client_meeting_contracts'); ?></td>
<td><?php the_field('development_approval'); ?></td>
<td><?php the_field('building_permit'); ?></td>
<td><?php the_field('colour_selection_docs'); ?></td>
<td><?php the_field('client_meeting_colour'); ?></td>
<td><?php the_field('estimate_vos'); ?></td>
<td><?php the_field('amend_docs'); ?></td>
<td><?php the_field('colour_selection_&_construction_certificate'); ?></td>
<td><?php the_field('schedule_project'); ?></td>
<td><?php the_field('purchase_orders'); ?></td>
<td><?php the_field('matrix_&_plan_printing'); ?></td>
<td><?php the_field('client_meeting_super'); ?></td>
<td><?php the_field('schedule_confirmed'); ?></td>
<td><?php the_field('site_start'); ?></td>
<td><?php the_field('est_&_supervision_schedule'); ?></td>
</tr>
<?php endforeach; wp_reset_postdata(); ?>