Support

Account

Home Forums General Issues Post object & Fields on Blog page Reply To: Post object & Fields on Blog page

  • Ah, I’ve sorted it!

    I only needed to add the posts page ID to the first call, like this:

    <?php $post_object = get_field('prospectus', 674);
    
    if( $post_object ):
    
    // override $post
    $post = $post_object;
    setup_postdata( $post );
    ?>
    <div class="side-box side-prospectus">
    	<img src="<?php the_field('image'); ?>" alt="<?php the_title(); ?>">
    
    	<h3><?php the_title(); ?></h3>
    	<p><?php the_field('description'); ?></p>
    
    	<?php
        $file = get_field('pdf_file');
    	if( $file ): ?>
    		<a href="<?php echo $file['url']; ?>" target="blank" class="button small button-icon-right button-icon-download"><?php _e('Download (PDF)','anglocontinental') ?></a>
    	<?php endif; ?>
    </div>
    
    <?php wp_reset_postdata(); ?>
    
    <?php endif; ?>