Post a Story

Advanced Custom Fields – Code to Display Blog Post in a Template Using a Function

<div style=”margin-left:50px; padding-left:50px; width:400px;”>

<?php

$post_object = get_field(‘blog1’);

if( $post_object ):

// override $post
$post = $post_object;
setup_postdata( $post );

?>
<div>
<h3><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a>

<?php the_post_thumbnail( ‘medium’ ); ?> </h3>

<?php echo wp_trim_words( get_the_content(), 60 );?>

</div>
<?php wp_reset_postdata(); // IMPORTANT – reset the $post object so the rest of the page works correctly ?>
<?php endif; ?>

</div>

0 Comments
  1. Howardveica 10 months ago
    Your comment is awaiting moderation.

    This is nicely expressed! !
    http://www.canadianpharmacymsn.com/
    canadapharmacyonline.com
    canadianpharmacy
    prescription price comparison
    canadian pharmacies without an rx

  2. Howardveica 10 months ago
    Your comment is awaiting moderation.
  3. Howardveica 10 months ago
    Your comment is awaiting moderation.
  4. Howardveica 10 months ago
    Your comment is awaiting moderation.
  5. Quentinimmaw 10 months ago
    Your comment is awaiting moderation.
  6. Quentinimmaw 10 months ago
    Your comment is awaiting moderation.
  7. Quentinimmaw 10 months ago
    Your comment is awaiting moderation.
  8. Quentinimmaw 10 months ago
    Your comment is awaiting moderation.
  9. Quentinimmaw 10 months ago
    Your comment is awaiting moderation.

Leave a reply

Your email address will not be published. Required fields are marked *

*

8992 Views
© RolePages / PebbleArt Inc. 2017

Log in with your credentials

or    

Forgot your details?

Create Account

Skip to toolbar