• Resolved thehonestape

    (@thehonestape)


    Hello,

    I am using your plugin to control a Conference session schedule + Film Festival

    I have created a separate custom post type for films, to separate it from session information, to make sure we can archive it differently.

    Anyway, for Films, I’m calling in session information, including the speakers list as a Post Object. I’m using the same bit of code used for the Page template and it gives me everything correctly (Thumbnail, Post Title) except for the_permalink. It keeps giving me the permalink of the current page that I’m on.

    Have been trying several things but can’t seem to figure out how to fix this.

    Thanks for any help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter thehonestape

    (@thehonestape)

    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.
    Plugin Author akyusa01

    (@akyusa01)

    Hi – customizations for our plugins are outside the scope of support, but you could try something like this:

    <?php echo esc_attr( get_permalink( get_queried_object_id() ) ); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘ACF – Post Object for Session Speakers List’ is closed to new replies.