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

Comment afficher les publications récentes dans WordPress

Note éditoriale : Nous percevons une commission sur les liens des partenaires sur WPBeginner. Les commissions n'affectent pas les opinions ou les évaluations de nos rédacteurs. En savoir plus sur Processus éditorial.

Voulez-vous afficher vos publications récentes dans WordPress ? L’affichage des publications récentes aide les utilisateurs/utilisatrices à découvrir facilement votre nouveau contenu et à passer plus de temps sur votre site.

Vous pouvez ajouter une liste de vos dernières publications dans votre colonne latérale, après la fin du contenu de votre publication, à l’intérieur du contenu de votre publication avec un code court, dans la zone de widget de votre pied de page, ou n’importe où ailleurs.

Dans cet article, nous allons vous afficher comment afficher les publications récentes dans WordPress en utilisant différentes méthodes.

How to display recent posts in WordPress

Pourquoi ajouter des publications récentes dans WordPress ?

Si vous gérez un blog ou un site WordPress depuis longtemps, il se peut que vous ayez des articles plus anciens qui reçoivent un trafic régulier des moteurs de recherche et d’autres sources.

Un grand nombre d’internautes consultent les informations qu’ils recherchent et s’en vont. Plus de 75 % de ces internautes ne reverront jamais votre site.

Pour que les utilisateurs/utilisatrices reviennent sur votre site, vous devez faire en sorte qu’ils y passent plus de temps.

Une façon de le faire est d’afficher d’autres publications récentes qu’ils devraient voir. Cela aide les utilisateurs/utilisatrices à découvrir plus de contenu sur votre site, ce qui les amène à passer plus de temps sur votre site.

Au fur et à mesure que les utilisateurs/utilisatrices voient plus de pages, cela vous donne le temps de les convaincre de s’inscrire à votre bulletin d’information par e-mail ou de faire un achat.

Ceci étant dit, voyons comment afficher facilement les publications récentes dans WordPress en utilisant plusieurs méthodes. Vous pouvez cliquer sur les liens rapides ci-dessous pour passer directement aux différentes méthodes :

Tutoriel vidéo

Subscribe to WPBeginner

Si vous préférez des instructions écrites, continuez à lire.

Méthode 1 : utiliser le bloc Gutenberg des dernières publications de WordPress.

L’éditeur WordPress block (Gutenberg) dispose d’un bloc intégré pour afficher vos dernières publications. Vous pouvez facilement l’ajouter à n’importe quelle publication ou page de votre site.

Pour utiliser ce bloc, il suffit de modifier la publication dans laquelle vous souhaitez afficher les derniers messages. Sur l’écran de modification de la publication, vous devez ajouter le bloc « Derniers messages » à la zone de contenu.

Add latest posts block

Ce bloc peut être configuré de différentes manières. Par défaut, il affiche simplement les titres des publications, mais vous pouvez facilement le personnaliser.

Par exemple, vous pouvez permuter le contenu de la publication dans le volet de droite. Vous pouvez ainsi choisir d’ajouter le contenu de la publication ou l’extrait à côté du titre.

Vous pouvez également personnaliser la longueur de l’extrait, qui est par défaut de 55 mots, mais vous pouvez choisir n’importe quelle valeur entre 10 et 100 mots.

Show post content in recent posts

Si vous le souhaitez, vous pouvez également afficher la date de publication et l’auteur/autrice de la publication.

Il suffit d’activer les options « Afficher la date de publication » et « Afficher le nom de l’auteur » dans les Réglages des méta-publications.

Display post date and author

Vous pouvez également choisir exactement comment vos publications seront affichées. Vous pouvez les commander différemment de l’affichage par défaut « du plus récent au plus ancien », et vous pouvez afficher uniquement les dernières publications d’une catégorie spécifique.

Dans le panneau des Réglages, vous pouvez également choisir le nombre de publications à afficher. Par défaut, le bloc affiche 5 publications, mais vous pouvez afficher entre 1 et 100 publications.

Sort and filter recent posts

Vous avez également l’option d’afficher vos publications récentes dans une grille de colonnes plutôt que dans une liste.

Il suffit de sélectionner l’option « Vue en grille » dans la barre d’outils.

View latest posts in grid view

Vous pouvez personnaliser la grille à l’aide des Réglages situés à droite de l’écran.

Par exemple, vous pouvez afficher des images mises en avant pour vos publications, redimmensionner les images et les aligner en conséquence.

Show featured images in latest posts

Une fois que vous avez terminé, vous pouvez prévisualiser la publication pour la voir sur votre site.

Voici à quoi ressemble le bloc fini en direct sur notre site de test.

Latest posts preview

Méthode 2 : Utiliser le widget des publications récentes de WordPress

Que faire si vous souhaitez afficher une liste de vos dernières publications dans votre colonne latérale plutôt que sur une page ? WordPress est livré avec un widget intégré par défaut pour afficher les dernières publications dans la colonne latérale de votre site ou dans n’importe quelle zone prête à accueillir un widget.

Dans votre tableau de bord WordPress, allez dans Apparence  » Widgets et ajoutez le bloc de widgets  » Dernières publications  » à votre colonne latérale.

Add latest post widget block

Vous pouvez ensuite personnaliser l’apparence de vos publications récentes dans la colonne latérale.

Par exemple, WordPress vous permet d’afficher le contenu des articles, d’indiquer l’auteur/autrice et la date de l’article, d’activer les images mises en avant et de trier vos dernières publications.

Customize recent posts widget block

Une fois que vous avez terminé, cliquez sur le bouton « Mettre à jour » pour stocker les réglages de votre widget.

Voici le widget en direct sur le blog, avec le titre ‘New Posts’ et les dates activées :

Latest posts in sidebar menu

Méthode 3 : Utiliser le widget des publications récentes avec miniatures (Recent Posts Widget With Thumbnails Plugin)

Le widget intégré que nous avons mentionné plus haut est assez limité.

Que faire si vous souhaitez afficher des miniatures et des extraits avec vos publications récentes ? Que faire si vous souhaitez afficher uniquement les publications d’une catégorie spécifique dans votre colonne latérale ?

C’est là que le plugin Recent Posts Widget With Thumbnails (widget des publications récentes avec miniatures) est utile. Il fait bien plus que des miniatures, et il est gratuit.

Tout d’abord, vous devez installer et activer le plugin WordPress Recent Posts Widget With Thumbnails.

Ensuite, rendez-vous sur la page Apparence  » Widgets, puis ajoutez le bloc de widgets ‘Recent Posts With Thumbnails’.

Add recent posts with thumbnails widget block

Le widget Recent Posts With Thumbnails est livré avec de nombreuses options. Il vous donne un contrôle total sur la façon dont vous souhaitez afficher les publications récentes sur votre site WordPress.

Vous pouvez également afficher des extraits, des publications de catégories spécifiques, ignorer les publications épinglées, choisir le nombre de publications à afficher, afficher les auteurs/autrices, etc.

Customize recent posts with thumbnails

Une fois que vous avez terminé, n’oubliez pas de cliquer sur le bouton « Mettre à jour » pour stocker vos Réglages.

Vous pouvez maintenant visiter votre site pour voir vos publications récentes avec des miniatures.

Recent posts widget with thumbnails preview

Méthode 4 : Afficher les publications récentes à l’aide d’un code court

L’utilisation du bloc  » Derniers articles  » est certainement le moyen le plus simple d’afficher les publications récentes dans les articles et les pages de WordPress. Cependant, si vous choisissez de désactiver Gutenberg et de conserver l’éditeur Classic, alors vous pouvez utiliser des codes courts à la place.

Tout d’abord, installez et activez l’extension Relevant. Si vous avez besoin d’aide, veuillez consulter notre guide sur l ‘installation d’une extension WordPress.

C’est l’une des extensions de publication les plus populaires pour WordPress. Vous disposez de nombreuses options pour personnaliser l’apparence de vos derniers articles, comme la modification du titre, le nombre de publications, la sélection de l’affichage d’une mis en avant, d’un extrait, de la date de publication, et plus encore.

Change relevant settings

Ensuite, il vous suffit de modifier un article ou une page où vous souhaitez afficher vos publications récentes, puis d’utiliser le code court [bws_latest_posts].

Voici à quoi ressemblait notre liste de publications récentes, en suivant ces instructions :

Display recent posts shortcode

Méthode 5 : Afficher manuellement les publications récentes dans WordPress

Les utilisateurs/utilisatrices plus avancés de WordPress peuvent vouloir ajouter les publications récentes directement dans les fichiers de leur thème WordPress. Bien sûr, vous devriez utiliser un thème enfant pour cela afin que lorsque vous mettez à jour votre thème, vous ne perdiez pas vos modifications.

C’est toujours une bonne idée de créer une sauvegarde avant de modifier les fichiers de votre thème. En cas de problème, vous pouvez consulter notre liste des erreurs WordPress les plus courantes et la manière de les corriger.

La façon la plus simple d’afficher manuellement les publications récentes est d’utiliser la classe WP_Query intégrée. Ajoutez simplement ce code à l’endroit où vous souhaitez afficher les publications récentes :

<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>

Ce code affiche les cinq publications les plus récentes avec leurs titres et extraits. La classe WP_Query possède des tonnes de paramètres qui vous permettent de la personnaliser à votre guise. En savoir plus, veuillez vous référer à la documentation développeur/développeuse de WordPress.

Guides d’experts sur la recommandation de publications dans WordPress

Maintenant que vous savez comment afficher les publications récentes dans WordPress, vous pouvez consulter d’autres articles similaires liés à la promotion du contenu auprès de vos lecteurs.

Nous espérons que cet article vous a aidé à apprendre comment afficher les publications récentes sur WordPress. Vous pourriez également être intéressé par notre guide sur la façon de créer une page séparée pour les articles de blog dans WordPress et notre choix d’experts des meilleurs plugins de constructeur de page WordPress par glisser-déposer.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Divulgation : Notre contenu est soutenu par les lecteurs. Cela signifie que si vous cliquez sur certains de nos liens, nous pouvons gagner une commission. Consultez comment WPBeginner est financé, pourquoi cela compte et comment vous pouvez nous soutenir. Voici notre processus éditorial.

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.

L'ultime WordPress Toolkit

Accédez GRATUITEMENT à notre boîte à outils - une collection de produits et de ressources liés à WordPress que tous les professionnels devraient avoir !

Reader Interactions

141 commentairesLaisser une réponse

  1. Syed Balkhi says

    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 says

    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 says

      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.

      Administrateur

  3. Bernie says

    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 says

      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!

      Administrateur

  4. Matt says

    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 says

      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.

      Administrateur

  5. Jack Yasgar says

    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 says

      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.

      Administrateur

    • WPBeginner Support says

      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.

      Administrateur

  6. Sean says

    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 says

      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

      Administrateur

  7. Lucy says

    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 says

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

      Administrateur

  8. Hamza says

    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

  9. Julian says

    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.

  10. Michael Robinson says

    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 says

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

      Administrateur

    • WPBeginner Support says

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

      Administrateur

    • WPBeginner Support says

      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.

      Administrateur

  11. Sarah says

    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?

  12. Ata says

    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?

  13. Arif says

    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 says

      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.

      Administrateur

  14. Rajiv Dave says

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

  15. Trang says

    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 says

      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.

      Administrateur

  16. Nikos Tzortzis says

    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?

  17. Rob says

    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?

  18. Bryan Free says

    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?

  19. eyllan8547 says

    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?

  20. Mankirat Deep Kaur says

    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…:(

  21. Kevin says

    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.

  22. James Gielow says

    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

  23. Adam says

    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?

  24. djafa says

    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?

  25. Louise says

    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.

  26. Ellen Allard (Gluten Free Diva) says

    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

  27. Tim Zeman says

    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?

  28. Val Archer says

    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

    • Andrew Wilkerson says

      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.

  29. Joe says

    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!

  30. Sally says

    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!

  31. Jason says

    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?

Laisser une réponse

Merci d'avoir choisi de laisser un commentaire. Veuillez garder à l'esprit que tous les commentaires sont modérés selon notre politique de commentaires, et votre adresse e-mail ne sera PAS publiée. Veuillez NE PAS utiliser de mots-clés dans le champ du nom. Ayons une conversation personnelle et significative.