Support

Account

Home Forums General Issues Post Object: get_post_meta Reply To: Post Object: get_post_meta

  • Hey James, let me clarify why I thought this might be related to ACF.

    
    
    					<?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 work on their 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; ?>
    

    I thought maybe I was ending the post object call wrong?

    Everything else works for the speakers list (thumbnail, post_title) just not the permalink.

    Abe