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

Como exibir posts recentes no WordPress

Nota editorial: Ganhamos uma comissão de links de parceiros no WPBeginner. As comissões não afetam as opiniões ou avaliações de nossos editores. Saiba mais sobre Processo editorial.

Deseja mostrar suas postagens recentes no WordPress? A exibição de publicações recentes ajuda os usuários a descobrir facilmente seu novo conteúdo e a passar mais tempo em seu site.

Você pode adicionar uma lista de suas últimas postagens na barra lateral, após o final do conteúdo da postagem, dentro do conteúdo da postagem com um shortcode, na área do widget do rodapé ou em qualquer outro lugar que desejar.

Neste artigo, mostraremos como exibir posts recentes no WordPress usando uma variedade de métodos diferentes.

How to display recent posts in WordPress

Por que adicionar posts recentes no WordPress?

Se você administra um blog ou site WordPress há muito tempo, talvez tenha alguns artigos mais antigos que recebem tráfego regular dos mecanismos de pesquisa e de outras fontes.

Muitos dos visitantes verificarão as informações que estavam procurando e sairão. Mais de 75% desses visitantes nunca mais verão seu site.

Para fazer com que os usuários voltem ao seu site, é preciso garantir que eles passem mais tempo no site.

Uma maneira de fazer isso é mostrar a eles outras publicações recentes que deveriam ser vistas. Isso ajuda os usuários a descobrir mais conteúdo no seu site, o que faz com que eles passem mais tempo no site.

À medida que os usuários visualizam mais páginas, você tem tempo para convencê-los a assinar o boletim informativo por e-mail ou fazer uma compra.

Dito isso, vamos dar uma olhada em como exibir facilmente as publicações recentes no WordPress usando vários métodos. Você pode clicar nos links rápidos abaixo para ir direto aos diferentes métodos:

Tutorial em vídeo

Subscribe to WPBeginner

Se você preferir instruções por escrito, continue lendo.

Método 1: Usar o Bloco Gutenberg de Últimos Posts do WordPress

O editor de blocos do WordPress (Gutenberg) tem um bloco integrado para exibir suas postagens mais recentes. Você pode adicioná-lo facilmente a qualquer postagem ou página do seu site.

Para usar esse bloco, basta editar a postagem em que você deseja exibir as postagens recentes. Na tela de edição do post, você precisa adicionar o bloco “Latest Posts” à área de conteúdo.

Add latest posts block

Há muitas maneiras diferentes de configurar esse bloco. Por padrão, ele mostra apenas os títulos das postagens, mas você pode personalizá-lo facilmente.

Por exemplo, você pode ativar e desativar o conteúdo da postagem no painel direito. Isso permite que você escolha adicionar o conteúdo da postagem ou o trecho ao lado do título.

Você também pode personalizar o tamanho do trecho, que tem como padrão 55 palavras, mas pode escolher qualquer valor entre 10 e 100 palavras.

Show post content in recent posts

Se desejar, você também pode exibir a data e o autor da postagem.

Basta ativar as opções “Exibir data de postagem” e “Exibir nome do autor” em Configurações de meta de postagem.

Display post date and author

Você também pode escolher exatamente como suas postagens serão exibidas. Você pode ordená-las de forma diferente da predefinida “Mais recente para a mais antiga” e pode mostrar apenas as postagens mais recentes de uma categoria específica.

No painel de configurações, você também pode escolher quantas publicações serão exibidas. Por padrão, o bloco mostra 5 publicações, mas você pode exibir entre 1 e 100 publicações.

Sort and filter recent posts

Você também tem a opção de exibir suas postagens recentes em uma grade de colunas em vez de uma lista.

Basta selecionar a opção “Grid view” na barra de ferramentas.

View latest posts in grid view

É possível personalizar a grade usando as configurações à direita da tela.

Por exemplo, você pode mostrar imagens em destaque para suas postagens, redimensionar as imagens e alinhá-las adequadamente.

Show featured images in latest posts

Quando terminar, você poderá visualizar a postagem para exibi-la em seu site.

Veja como o bloco finalizado aparece ao vivo em nosso site de teste.

Latest posts preview

Método 2: Use o bloco de widgets de postagens recentes do WordPress

E se você quiser mostrar uma lista das suas últimas publicações na barra lateral em vez de em uma página? O WordPress vem com um widget padrão integrado para exibir as publicações recentes na barra lateral do seu site ou em qualquer área preparada para widgets.

No painel do WordPress, vá para Appearance ” Widgets e adicione o bloco do widget “Latest Posts” à barra lateral.

Add latest post widget block

Em seguida, você pode personalizar a aparência de suas postagens recentes na barra lateral.

Por exemplo, o WordPress permite que você mostre o conteúdo da postagem, exiba o autor e a data da postagem, habilite imagens em destaque e classifique suas postagens mais recentes.

Customize recent posts widget block

Quando terminar, clique no botão “Update” (Atualizar) para armazenar as configurações do widget.

Aqui está o widget ao vivo no blog, com o título “New Posts” e as datas ativadas:

Latest posts in sidebar menu

Método 3: Use o plug-in Recent Posts Widget With Thumbnails (Widget de postagens recentes com miniaturas)

O widget incorporado mencionado acima é bastante limitado.

E se você quiser exibir miniaturas e trechos com suas postagens recentes? E se você quiser mostrar somente as postagens de uma categoria específica na barra lateral?

Bem, é nesse momento que o plug-in Recent Posts Widget With Thumbnails é útil. Ele faz muito mais do que apenas miniaturas, e é gratuito.

Primeiro, você precisará instalar e ativar o plug-in WordPress Recent Posts Widget With Thumbnails.

Em seguida, vá para a página Appearance ” Widgets e adicione o bloco do widget “Recent Posts With Thumbnails”.

Add recent posts with thumbnails widget block

O widget Recent Posts With Thumbnails vem com muitas opções. Ele lhe dá controle total sobre como deseja exibir as postagens recentes no seu site WordPress.

Você também pode mostrar trechos, mostrar postagens de categorias específicas, ignorar postagens fixas, escolher o número de postagens a serem mostradas, exibir autores e muito mais.

Customize recent posts with thumbnails

Quando terminar, não se esqueça de clicar no botão “Update” (Atualizar) para armazenar suas configurações.

Agora você pode visitar seu site para ver suas postagens recentes com miniaturas.

Recent posts widget with thumbnails preview

Método 4: Exibir posts recentes usando um código curto

Usar o bloco “Latest Posts” é definitivamente a maneira mais fácil de exibir posts recentes em posts e páginas do WordPress. No entanto, se você optar por desativar o Gutenberg e manter o editor clássico, poderá usar códigos de acesso.

Primeiro, instale e ative o plug-in Relevant. Se precisar de ajuda, consulte nosso guia sobre como instalar um plug-in do WordPress.

É um dos plug-ins de postagem mais populares para WordPress. Você tem várias opções para personalizar a aparência de suas postagens mais recentes, como editar o título, o número de postagens, selecionar se deseja exibir uma imagem em destaque, um trecho, a data da postagem e muito mais.

Change relevant settings

Em seguida, basta editar um post ou uma página em que deseja exibir seus posts recentes e usar o shortcode [bws_latest_posts].

Veja como ficou nossa lista de postagens recentes, usando essas instruções:

Display recent posts shortcode

Método 5: Exibir posts recentes manualmente no WordPress

Usuários mais avançados do WordPress podem querer adicionar publicações recentes diretamente aos arquivos de tema do WordPress. É claro que você deve usar um tema filho para isso, de modo que, ao atualizar o tema, não perca as alterações.

É sempre uma boa ideia criar um backup antes de editar os arquivos do tema. Se algo der errado, dê uma olhada em nossa lista dos erros mais comuns do WordPress e como corrigi-los.

A maneira mais fácil de exibir manualmente as postagens recentes é usar a classe WP_Query integrada. Basta adicionar este código onde você deseja exibir as postagens recentes:

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

Esse código exibe as cinco publicações mais recentes com seus títulos e trechos. A classe WP_Query tem vários parâmetros que permitem que você a personalize da maneira que desejar. Para obter mais informações, consulte a documentação do desenvolvedor do WordPress.

Guias especializados sobre recomendação de publicações no WordPress

Agora que você já sabe como exibir posts recentes no WordPress, talvez queira ver outros artigos relacionados à promoção de conteúdo para seus leitores.

Esperamos que este artigo tenha ajudado você a aprender como exibir posts recentes no WordPress. Talvez você também se interesse por nosso guia sobre como criar uma página separada para publicações de blog no WordPress e por nossa seleção especializada dos melhores plug-ins de criação de páginas do WordPress do tipo arrastar e soltar.

Se você gostou deste artigo, inscreva-se em nosso canal do YouTube para receber tutoriais em vídeo sobre o WordPress. Você também pode nos encontrar no Twitter e no Facebook.

Divulgação: Nosso conteúdo é apoiado pelo leitor. Isso significa que, se você clicar em alguns de nossos links, poderemos receber uma comissão. Veja como o WPBeginner é financiado, por que isso é importante e como você pode nos apoiar. Aqui está nosso processo editorial.

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.

O kit de ferramentas definitivo WordPress

Obtenha acesso GRATUITO ao nosso kit de ferramentas - uma coleção de produtos e recursos relacionados ao WordPress que todo profissional deve ter!

Reader Interactions

141 ComentáriosDeixe uma resposta

  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.

      Administrador

  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!

      Administrador

  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.

      Administrador

  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.

      Administrador

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

      Administrador

  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

      Administrador

  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.

      Administrador

  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.

      Administrador

    • WPBeginner Support says

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

      Administrador

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

      Administrador

  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.

      Administrador

  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.

      Administrador

  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?

Deixe uma resposta

Obrigado por deixar um comentário. Lembre-se de que todos os comentários são moderados de acordo com nossos política de comentários, e seu endereço de e-mail NÃO será publicado. NÃO use palavras-chave no campo do nome. Vamos ter uma conversa pessoal e significativa.