Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
Coppa WPB
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Come visualizzare i post recenti in WordPress

Come WPBeginner, molti blog popolari visualizzano un elenco delle pubblicazioni più recenti. Questo perché mostrare le pubblicazioni più recenti è un ottimo modo per mantenere i visitatori impegnati e farli tornare.

Quando le persone vedono i vostri contenuti più recenti e più belli, è più probabile che facciano clic, leggano e passino del tempo a esplorare il vostro sito. In questo modo il sito web risulta fresco e stimolante.

La cosa migliore è che potete aggiungere questi elenchi di articoli recenti quasi ovunque sul vostro sito web WordPress, ad esempio nella barra laterale, alla fine di un articolo o persino nel footer.

In questo articolo vi mostreremo alcuni modi semplici per aggiungere un elenco di pubblicazioni recenti al vostro sito, ovunque vogliate che appaia. Preparatevi a tenere i visitatori sempre hookati dai vostri fantastici contenuti.

How to display recent posts in WordPress

Perché aggiungere i post recenti in WordPress?

Se gestite un blog o un sito web WordPress da molto tempo, potreste avere alcuni vecchi articoli che ricevono regolarmente traffico dai motori di ricerca e da altre fonti.

Molti dei visitatori controllano le informazioni che stavano cercando e se ne vanno. Oltre il 75% di questi visitatori non vedrà mai più il vostro sito web.

Per far sì che gli utenti tornino a visitare il vostro sito, dovete fare in modo che trascorrano più tempo sul vostro sito.

Un modo per farlo è mostrare loro altri post recenti che dovrebbero vedere. Questo aiuta gli utenti a scoprire più contenuti sul vostro sito web, il che li porta a trascorrere più tempo sul vostro sito.

Man mano che gli utenti visualizzano più pagine, avete il tempo di convincerli a iscriversi alla vostra newsletter o a fare un acquisto.

Detto questo, vediamo come visualizzare facilmente i post recenti in WordPress utilizzando diversi metodi. Potete cliccare sui link rapidi qui sotto per passare direttamente ai diversi metodi:

Video tutorial

Subscribe to WPBeginner

Se preferite le istruzioni scritte, continuate a leggere.

Metodo 1: Utilizzare il blocco Gutenberg degli ultimi messaggi di WordPress

L’editor di blocchi di WordPress (Gutenberg) ha un blocco integrato per visualizzare gli ultimi post. È possibile aggiungerlo facilmente a qualsiasi post o pagina del sito.

Per utilizzare questo blocco, è sufficiente modificare il post in cui si desidera visualizzare i messaggi recenti. Nella schermata di modifica del post, è necessario aggiungere il blocco “Ultimi messaggi” all’area dei contenuti.

Add latest posts block

È possibile configurare questo blocco in molti modi diversi. Per impostazione predefinita, mostra solo i titoli dei post, ma è possibile personalizzarlo facilmente.

Ad esempio, è possibile attivare e disattivare il contenuto del post nel riquadro di destra. In questo modo si può scegliere se aggiungere il contenuto del post o un estratto accanto al titolo.

È inoltre possibile personalizzare la lunghezza dell’estratto, che per impostazione predefinita è di 55 parole, ma è possibile scegliere qualsiasi valore compreso tra 10 e 100 parole.

Show post content in recent posts

Se si desidera, è possibile visualizzare anche la data e l’autore del post.

È sufficiente attivare le opzioni “Visualizza la data del post” e “Visualizza il nome dell’autore” in Impostazioni dei meta-post.

Display post date and author

È inoltre possibile scegliere esattamente come visualizzare i post. È possibile ordinarli in modo diverso da quello predefinito “dal più recente al più vecchio” e mostrare solo gli ultimi post di una categoria specifica.

Dal pannello delle impostazioni è possibile scegliere il numero di messaggi da visualizzare. Per impostazione predefinita, il blocco mostra 5 messaggi, ma si possono visualizzare da 1 a 100 messaggi.

Sort and filter recent posts

È inoltre possibile visualizzare i post recenti in una griglia di colonne anziché in un elenco.

È sufficiente selezionare l’opzione “Vista griglia” nella barra degli strumenti.

View latest posts in grid view

È possibile personalizzare la griglia utilizzando le impostazioni a destra dello schermo.

Ad esempio, è possibile mostrare immagini in primo piano per i post, ridimensionare le immagini e allinearle di conseguenza.

Show featured images in latest posts

Una volta terminato, è possibile visualizzare l’anteprima del post sul proprio sito web.

Ecco come appare il blocco finito dal vivo sul nostro sito di prova.

Latest posts preview

Metodo 2: Utilizzare il blocco di widget dei messaggi recenti di WordPress

E se si volesse mostrare un elenco degli ultimi post nella barra laterale invece che in una pagina? WordPress è dotato di un widget predefinito per visualizzare i post recenti nella barra laterale del sito o in qualsiasi area predisposta per i widget.

Nella dashboard di WordPress, andare su Aspetto ” Widget e aggiungere il blocco widget “Ultimi messaggi” alla barra laterale.

Add latest post widget block

È quindi possibile personalizzare l’aspetto dei post recenti nella barra laterale.

Ad esempio, WordPress consente di mostrare il contenuto dei post, di visualizzare l’autore e la data del post, di attivare le immagini in evidenza e di ordinare gli ultimi post.

Customize recent posts widget block

Al termine, fare clic sul pulsante “Aggiorna” per memorizzare le impostazioni del widget.

Ecco il widget dal vivo sul blog, con il titolo “Nuovi messaggi” e le date abilitate:

Latest posts in sidebar menu

Metodo 3: Usare il widget dei post recenti con le miniature

Il widget integrato di cui abbiamo parlato sopra è piuttosto limitato.

E se volete visualizzare miniature ed estratti dei vostri post recenti? E se voleste mostrare solo i post di una categoria specifica nella vostra barra laterale?

In questo caso, il plugin Recent Posts Widget With Thumbnails è utile. Fa molto di più delle semplici miniature ed è gratuito.

Per prima cosa, è necessario installare e attivare il plugin WordPress Recent Posts Widget With Thumbnails.

Successivamente, andare alla pagina Aspetto ” Widget e aggiungere il blocco di widget “Messaggi recenti con anteprime”.

Add recent posts with thumbnails widget block

Il widget Messaggi recenti con miniature è dotato di molte opzioni. Vi dà il pieno controllo su come volete visualizzare i post recenti sul vostro sito WordPress.

È inoltre possibile mostrare estratti, mostrare post di categorie specifiche, ignorare i post appiccicati, scegliere il numero di post da mostrare, visualizzare gli autori e altro ancora.

Customize recent posts with thumbnails

Una volta terminato, non dimenticate di fare clic sul pulsante “Aggiorna” per memorizzare le impostazioni.

Ora è possibile visitare il proprio sito web per vedere i post recenti con le miniature.

Recent posts widget with thumbnails preview

Metodo 4: visualizzare i post recenti con uno shortcode

L’utilizzo del blocco “Ultimi messaggi” è sicuramente il modo più semplice per visualizzare i messaggi recenti nei post e nelle pagine di WordPress. Tuttavia, se si sceglie di disabilitare Gutenberg e di mantenere l’editor classico, è possibile utilizzare gli shortcode.

Innanzitutto, installate e attivate il plugin Relevant. Se avete bisogno di aiuto, consultate la nostra guida su come installare un plugin di WordPress.

È uno dei più popolari plugin per WordPress. Sono disponibili diverse opzioni per personalizzare l’aspetto dei post più recenti, come la modifica del titolo, il numero di post, la scelta di visualizzare o meno un’immagine in evidenza, un estratto, la data del post e altro ancora.

Change relevant settings

Quindi, è sufficiente modificare un post o una pagina in cui si desidera visualizzare i post recenti e utilizzare lo shortcode [bws_latest_posts].

Ecco come appariva il nostro elenco di post recenti, utilizzando queste istruzioni:

Display recent posts shortcode

Metodo 5: Visualizzare i messaggi recenti manualmente in WordPress

Gli utenti WordPress più avanzati potrebbero voler aggiungere i post recenti direttamente ai file del loro tema WordPress. Naturalmente, è consigliabile utilizzare un tema figlio per questo scopo, in modo che quando si aggiorna il tema non si perdano le modifiche apportate.

È sempre una buona idea creare un backup prima di modificare i file del tema. Se qualcosa dovesse andare storto, potreste dare un’occhiata al nostro elenco degli errori più comuni di WordPress e a come risolverli.

Il modo più semplice per visualizzare manualmente i post recenti è utilizzare la classe WP_Query integrata. È sufficiente aggiungere questo codice nel punto in cui si desidera visualizzare i post recenti:

<ul>
 
<?php
// Define our WP Query Parameters
$the_query = new WP_Query( 'posts_per_page=5' ); ?>
 
<?php
// Start our WP Query
while ($the_query -> have_posts()) : $the_query -> the_post();
// Display the Post Title with Hyperlink
?>
 
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
 
<li><?php
// Display the Post Excerpt
the_excerpt(__('(more…)')); ?></li>
 
<?php
// Repeat the process and reset once it hits the limit
endwhile;
wp_reset_postdata();
?>
</ul>

Questo codice visualizza i cinque post più recenti con i loro titoli ed estratti. La classe WP_Query ha molti parametri che consentono di personalizzarla in qualsiasi modo. Per ulteriori informazioni, consultare la documentazione per sviluppatori di WordPress.

Guide di esperti su come raccomandare i post in WordPress

Speriamo che questo articolo vi abbia aiutato a capire come visualizzare i post recenti in WordPress. Potreste essere interessati anche ad altri articoli relativi alla promozione dei contenuti ai vostri lettori:

Se questo articolo vi è piaciuto, iscrivetevi al nostro canale YouTube per le esercitazioni video su WordPress. Potete trovarci anche su Twitter e Facebook.

Divulgazione: I nostri contenuti sono sostenuti dai lettori. Ciò significa che se cliccate su alcuni dei nostri link, potremmo guadagnare una commissione. Vedi come WPBeginner è finanziato , perché è importante e come puoi sostenerci. Ecco il nostro processo editoriale .

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Il kit di strumenti WordPress definitivo

Ottenete l'accesso gratuito al nostro kit di strumenti - una raccolta di prodotti e risorse relative a WordPress che ogni professionista dovrebbe avere!

Reader Interactions

141 commentiLascia una risposta

  1. Syed Balkhi

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Jiří Vaněk

    I would like to post these recents at the end of each article. But there are already more than 1000 of them. It doesn’t make sense to do it manually. Is it possible to take the php code, insert it into WPCode and use the embed code at the end of each article? Will it work like this?

    • WPBeginner Support

      If you wanted to you could certainly do that :)

      Admin

  3. Mike

    Is any way to use shortcode like [bws_latest_posts tag=”something”]?

    Thanks!

    • WPBeginner Support

      There are some options in the plugin settings to limit the categories but at the moment the plugin does not have a modifier like that for the shortcode.

      Admin

  4. Bernie

    Thanks for lots of great advice!

    I have been spending days so far, to solve a challange here:

    Im using the Twenty Twenty-Three template.

    Using Gutenberg.

    Created a 2nd column where i would like to place a list of the latest posts by CURRENT author, incl. thumbnail, except etc.

    I can only find this solution in plugins with widgets, and as far as I understand this Gutenberg thing, widgets cant be used here.

    Any idea how to solve this?

    • WPBeginner Support

      If you are manually adding it to each post, there is a latest posts block that gives the option to limit the posts listed by author and a few other sorting options that you can use as well!

      Admin

  5. Matt

    How to enable a link to more pages/posts? The widget only says up to 100, but how to paginate etc if there are 1000 or more?

    • WPBeginner Support

      We do not recommend having more than 100 posts in a widget due to that being difficult for most users to read through for its space. If you are displaying that many posts we would recommend displaying it on a page or something similar.

      Admin

  6. Jack Yasgar

    When I use the WordPress Latest Posts Gutenberg Block, it displays all the texts of the posts. In the preview when I add it to the page, it looks fine, with the “Read More”, but when you actually preview or publish the page, all the text is displayed and it looks terrible. This is on Version 5.9.1. Any suggestions or is it just a bug?

    • WPBeginner Support

      You would want to check the settings for your widget as that should be where you can customize how your widget is displayed. If it is not following those settings then you would likely want to reach out to the support for your theme in case it is overriding your settings.

      Admin

  7. Dileepa

    Is it possible to display posts that are specific for a certain ‘Category’ as a Recent Post?

    • WPBeginner Support

      The simplest method would be to add a category to your menu and that would link to a category page that would list your most recent posts in that category.

      Admin

  8. Sean

    I’m using ‘Display Posts’ and love it. I run a gardening website so if a post is called ‘How to Grow Beetroot’, is there any way by using Display Posts that the only part of the title that is displayed is ‘Beetroot’?

    Thank you

    • WPBeginner Support

      The plugin by default does not change your post titles. You would want to reach out to the plugin’s support if you wanted that functionality

      Admin

  9. Lucy

    I can’t seem to get the Read More to appear in the published version. It appears in the editor but when I publish, it is gone. I’m using Astra theme.

    • WPBeginner Support

      You would want to check for if you need to enable excerpts with your specific theme for it to display how you are wanting.

      Admin

  10. Hamza

    Hi, When I click on the “Read more..” on a post on Recent Posts, it does not to go to that specific post page rather it loads the home page.

    Appreciate if you can help on this.

    Thanks

    • WPBeginner Support

      It would depend on what method you are using for possible issues and solutions.

      Admin

  11. Julian

    This was really helpful thanks. Just a correction to note, in the last code snippet the comments are using // but they’re not actually in the php so they will show up if you use this code as-is.

    • WPBeginner Support

      Thank you for pointing that out, we’ll update the code to fix this :)

      Admin

  12. Michael Robinson

    Hi, I”m still lost. My posts still don’t show up on my homepage, I have content blocks set up on my homepage and using Guterberg to set up the content. When I publish the post. It does not show up on my Homepage feature posts grid. There is something I am not getting.

    • WPBeginner Support

      You may want to clear any caching on your site to ensure your caching is not preventing the changes from being seen.

      Admin

  13. Venkat

    My blog shows bulleted post, how do I stop it from being an unordered list, and make it in grid?

    • WPBeginner Support

      You can use the new latest post block and use the built-in grid option in the block’s options

      Admin

  14. Mohammed

    Hello Friends,

    My query is what is the short code to display all the content of a post?!

    • WPBeginner Support

      It would depend on why you want to do that. If you want the entire content of a post to be visible to a user it would normally be best to link to the post you want to show so your users can read from the source.

      Admin

  15. Miracle Lawrence

    My blog shows bulleted post, how do I stop it from being an unordered list, and make it in grid?

  16. Sarah

    Hello – I am trying to figure out why the Recent Posts widget (the basic one) is excluding my most recent post. I would like that to show. Is there custom CSS I could add to make it show? or can I edit the code?

  17. Ata

    Thank you for the useful post.
    I have a question. What if I want to display recent posts on front page categories wise. Like recent posts should appear on the front page under a particular category.
    Is it possible?

  18. Arif

    Awesome as always. When I found wpbeginner is sharing on this topic I was like . But my question is placing post widget on homepage is beneficial or it’s just easy to navigate? Can it help with seo perspective? Can it help with the ranking? Your response highly appreciated

    • WPBeginner Support

      Making your site easier to navigate can improve your SEO as well as making it easier for your users to continue navigating through your site.

      Admin

  19. Rajiv Dave

    Thanks for recent post articles. I was trying so much but now its so easy to work just adding adding it. Thanks for sharing

    • WPBeginner Support

      Glad our article was helpful :)

      Admin

  20. aditya tomar

    thank you so much. this helped me a lot. thank you thank you :) :).

    • WPBeginner Support

      You’re welcome :)

      Admin

  21. Trang

    When I tried to edit the page that’s supposed to display blog posts, the editor disappears wit this notice: “You are currently editing the page that shows your latest posts”. Does anyone have this same problem as me?

    • WPBeginner Support

      The Blog page is automatically generated by your theme so you will not have the option to edit it directly unless you have a theme specific setting to edit it.

      Admin

  22. Nikos Tzortzis

    HI…..i just started using WP and i need some help! i want to publish articles from 3 different categories to 3 different pages.how can i make a page point to an article category?

  23. Rob

    Is there a way to customize the way post titles are displayed? I don’t want to display the full title of the post or page, just the keywords… much like you shorten the slug for your url. Actually this is exactly what I’m looking for, to display the slug as a link, and not the entire page title. Ideas?

  24. Bryan Free

    Great article, When I use the Recent post widget and set it to only display a category my sticky posts do not work. Have you encountered this before or know of a solution?

  25. eyllan8547

    Hi, thanks for this complete article.

    I have a doubt, if I have my wordpress integrated with Magento, can I use magento within the short code to put the last entries in my magento house?

  26. Mankirat Deep Kaur

    The short code to display recent posts with thumbnails does not work… only shows the posts title not the thumbnails… how to fix this.??? please reply…:(

  27. Kevin

    Hi,

    I am intending on adding the latest posts on my homepage, but I want a different section for the latest post to display on it’s own;

    and another section under this designed differently for the latest posts that range from 2-5. (The 2nd, 3rd, 4th and 5th post).

    What is the shortcode php for this to add to my theme template.

    Many thanks.

  28. James Gielow

    Hello,

    I have post shortcode on my page:

    I’ve tweaked it a little bit as follows:

    [display-posts posts_per_page=”100″ include_excerpt=”false” image_size=”large” wrapper=”div” orderby=”comment_count”]

    I’m noticing that the spacing in between the posts is cutting off the titles and it makes the page look sloppy. What code can I add to add a little space after each post preview?

    thanks in advance!
    James

  29. Paul

    Thanks! I was struggling with adding recent posts to a page. Your guide saved me a lot of time :)

  30. Erpel

    Thank you for this tutorial!

  31. Adam

    Love the idea, the only thing I don’t like is the display.

    So it’s great how it has the thumbnail, title, excerpt, etc but the way the title and excerpt are positioned…I think they should be inline with the thumbnail, not at the bottom of it…it looks awkward and unappealing…any way to make it inline?

  32. Kenneth

    Please help me with this
    How to display recently post in a post on phone version?
    Reply please… Thanks

  33. sai

    If I am using 2 database. 1 for main site and 2nd for blog then how to add recent post on home page ?

  34. djafa

    Hi, I put [display-posts posts_per_page=”5″ post_type=”page”] on my post, but not working, can you help how to find the problem?

  35. Kev

    Great writeup. I want to display the recent post on a page. awahere am I suppose to paste the code?

  36. Clark Keng

    this article can help me thank you : )

  37. Id abdou

    gereat … thanks a lot .

  38. PARAM

    How to show thumbnail of 1st post bigger and others smaller…..

    • Brad

      You could perhaps use :first-child CSS to do this.

  39. Louise

    Hi,
    Thank you for this post. Really helped a lot.
    But then I have a problem. When I click on one of the recent posts – it directed me to the static page and not the post itself. Kindly help me resolved this issue. Thank you.

    • WPBeginner Support

      Try updating your permalink structure. Simply visit Settings » Permalinks and then click on the save changes button without changing anything.

      Admin

  40. Ellen Allard (Gluten Free Diva)

    So glad to have found you!

    I’m confused – I can’t seem to get my most recent blog post to appear on my blog page. Can you advise please? Thank you so much!

    best, Ellen Allard, Gluten Free Diva

  41. Tim Zeman

    So I was able to get the 5 latest post to show in the right sidebar but when I click on a post to read it I get the following error on Home Page Oops something went wrong

    How do I get the selected post to display?

  42. John Mason

    Are links to the recent posts widget dofollow links?

  43. Val Archer

    Hi – thanks million for this manual method, very grateful. Please can you tell me how to add a thumbnail image to it? I’m referring to the method starting:

    // Define our WP Query Parameters

    • Rajkumar

      hello,
      To display a thumbnail image u can ues

    • Andrew Wilkerson

      Hi Val, Hope your doing well, I was just scrolling through this article and saw your name and thought straight away I know that name! It’s a small world.
      I made one of your sprouters in the late 90’s I think it would have been.
      Funny thing is I was just thinking about building another one a few days ago!

      Crazy how things happen sometimes!
      Weird that I then just stumbled across your comment on here today in 2018 while I’m working on my website for something totally unrelated.

      I remember I really enjoyed reading about your life and the move to Sth Africa, your cures for tooth aces etc. I’ll have to have another look into it all again soon when I have time, anyway just thought I’d say Hi.

  44. Farhad

    Hello, I used the same shortcut in my site but it not show my recent posts at all, what is the probelm?

  45. Marcio

    Hey, how to display recent posts from another wordpress site?

  46. Joe

    Hi,

    On my recent posts on the sidebar, when I click a specific post it brings me to the latest post and then displays everything. How do I get it so that when I click a specific post it only shows that post?

    Thanks!

  47. Sally

    Is there a code I can add to activate pagination using the Recent Posts Extended widget?

    Currently I have my home page widgetized so I’m using the widget.

    Thanks!

  48. alin dragoescu

    Hello,

    Please let me know if it’s posible to show the post list in dropdown?

  49. Nick NEvsky

    Hi! Great plugin, thank you!
    Is it possible to have the author listed, instead of the post name?
    Thanks!

  50. Jason

    The version I downloaded does not include the ability to display thumbnails…cant see the option anywhere. I am using version 0.9.9

    Any clues?

Lascia una risposta

Grazie per aver scelto di lasciare un commento. Tenga presente che tutti i commenti sono moderati in base alle nostre politica dei commenti e il suo indirizzo e-mail NON sarà pubblicato. Si prega di NON utilizzare parole chiave nel campo del nome. Avremo una conversazione personale e significativa.