Support

Account

Home Forums General Issues Relationship Post Object / Post ID Reply To: Relationship Post Object / Post ID

  • Hello,

    Ive tried that but have been unable to show the results nothing appears for the title

    						$date = get_posts(array(
    							'post_type' => 'course-dates',
    							'meta_query' => array(
    								array(
    									'key' => 'course', // name of custom field
    									'value' => '"' . $course_id . '"', // matches exaclty "123", not just 123. This prevents a match for "1234"
    									'compare' => 'LIKE'
    								)
    							)
    						));
    
    						?>
    						<?php if( $date ): ?>
    
    							<table>
    								<thead>
    									<tr>
    										<th class="content-pad">Date</th>
    										<th>Time</th>
    										<th>Spaces</th>
    										<th>Price</th>
    										<th>Book</th>
    									</tr>
    								</thead>
    								<tbody>
    							<?php foreach( $date as $dates ): 
    					
    							$spacesleft = get_field('spaces',$dates->ID);?>
    								<tr>
    									<td class="content-pad"><?php the_field('startdate',$dates->ID);?>
    
    									<?php $course_title = get_field('course');
    
    						?>
    						<?php if( $course_title ): ?>
    							<?php foreach( $course_title as $course ): ?>
    								
    										<?php echo get_the_title( $course->ID ); ?>
    							<?php endforeach; ?>
    						<?php endif; ?>