Alright, here’s the bit of code that I”m talking about.
<?php
$post_object = get_field('film_session');
if( $post_object ):
// override $post
$post = $post_object;
setup_postdata( $post );
?>
<?php
$cr3ativconfmeetingdate = get_post_meta($post->ID, 'cr3ativconfmeetingdate', $single = true);
$confstarttime = get_post_meta($post->ID, 'cr3ativ_confstarttime', $single = true);
$confendtime = get_post_meta($post->ID, 'cr3ativ_confendtime', $single = true);
$confdisplaystarttime = get_post_meta($post->ID, 'cr3ativ_confdisplaystarttime', $single = true);
$confdisplayendtime = get_post_meta($post->ID, 'cr3ativ_confdisplayendtime', $single = true);
$cr3ativ_confspeakers = get_post_meta($post->ID, 'cr3ativ_confspeaker', $single = true);
/* ACF Fields Within Session */
$ticket_link = get_field('ticket_link');
?>
<div class="speaker_list">
<?php
$cr3ativ_confspeakers = get_post_meta($post->ID, 'cr3ativ_confspeaker', $single = true);
?>
<?php
if ( $cr3ativ_confspeakers ) {
foreach ( $cr3ativ_confspeakers as $cr3ativ_confspeaker ) :
/* What I had to hack for this to somewhat wark, but title must match */
$speaker = get_post($cr3ativ_confspeaker);
echo'<div class="speaker_list_wrapper">';
$speakerlink = sanitize_title_with_dashes($speaker->post_title);
echo '<a href=' . '/speaker/' . $speakerlink . '>';
echo get_the_post_thumbnail($speaker->ID). '<div class="redact redact__small">' . $speaker->post_title .'</div></a></div>';
/*-- End workaround
/* How it usually works on conference templates
$speaker = get_post($cr3ativ_confspeaker);
$speakerlink = get_permalink( $speaker->ID ); // Permalink returning current page URL
echo'<div class="speaker_list_wrapper">';
echo '<a href="'. $speakerlink .'">';
echo get_the_post_thumbnail($speaker->ID). '<div class="redact redact__small">' . $speaker->post_title .'</div></a></div>';
*/
endforeach;
} ?>
</div><!-- End of speaker list -->
<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
<?php endif; ?>
-
This reply was modified 8 years, 5 months ago by
thehonestape.