The template tags (like the_content()
) aren’t available when using get_posts
. In order to make the template tags available, you have to make use of setup_postdata( $post );
Example:
<?php
$posts = get_posts('category_name=category-test');
foreach($posts as $post) {
setup_postdata( $post );
the_title(); ?>
<p><?php the_content(); ?></p>
<?php } ?>