For some reason I am unable to output the custom post type content using the following code. what am I missing here? It works fine for get_the_title
yet using get_the_content
using same parameters yields nothing.
<?php
$query = new WP_Query( ['post_type' => 'testimonials', 'posts_per_page' => -1 ] );
foreach($query->get_posts() as $testimonial):
$meta = get_post_meta($testimonial->ID);
foreach($meta as &$m){
if(is_array($m)){
$m = $m[0];
}
} ?>
<div class="content"><?=get_the_content($testimonial->ID); ?></div>
<div class="author">- <?=get_the_title($testimonial->ID); ?> / <span class="company_name"><?=$meta['_testimonial_company_name'] ?></span></div>
<div class="link"><a href="https://wordpress.stackexchange.com/questions/277872/<?=home_url("/testimonials'); ?>" title="View All Testimonials">View More</a></div>
<?php endforeach; ?>