I did create a custom page template and assigned to a page.
I have this code inside:
Template Name: Ultime novità
<?php get_header(); ?>
$news_filter = array(
‘category’ => ’53’,
‘posts_per_page’ => 5
$news = get_posts( $news_filter );
echo count ( $news );
foreach ($news as $post) : setup_postdata($post);
It works, but I would learn more and more wordpress so, I would ask, if is there a better code to do this.
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?
Read more here:: get posts from only one category. Is there a better practice?