This question already has an answer here:
- Display content from a specific category 5 answers
I did create a custom page template and assigned to a page.
I have this code inside:
$news_filter = array( 'category' => '53', 'posts_per_page' => 5, ); $news = get_posts( $news_filter ); echo count ( $news ); foreach ( $news as $post ) : setup_postdata( $post ); the_post_thumbnail(); the_title(); the_content(); endforeach;
It works, but I would learn more and more wordpress so, I would ask, if is there is a way to avoid having to run two queries? For example, I know existing of (custom) filter. Instead to make the loop twice (by WP and by me), can we add a filter, block WP and perform a custom loop?