Reputation: 1239
I'm using PODS to create custom post types. I want to display these post types in my custom template. I've been able to display the title, image, but haven't found a way to display body content yet. I have tried get_the_content( $id )
without luck. Any ideas?
<?php
$pod = pods( 'selectoffers' );
$related = $pod->field( 'select' );
if ( ! empty( $related ) ) {
foreach ( $related as $rel ) {
$id = $rel[ 'ID' ];?>
<div class="col-lg-4">
<div class="round-img img-circle" style="background-image:url('<?php echo pods_image_url(get_post_meta( $id, 'bilde', true ), $size = 'full'); ?>');"></div>
<h2><?php echo get_the_title( $id ); ?></h2>
<p> [[THIS IS WHERE I WANT TO ADD THE BODY]] </p>
<p><a class="btn btn-default" href="<?php $lenke = get_post_meta( $id, 'lenke', true );
echo esc_url( get_permalink( array_shift($lenke) ) ); ?>" role="button">Les mer »</a></p>
</div><!-- /.col-lg-4 -->
<?php
} //end of foreach
} //endif ! empty ( $related )
?>
Upvotes: 0
Views: 568
Reputation: 1239
Made it working using the following code:
$content_post = get_post($id);
$content = $content_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
echo $content;
Upvotes: 1