簡體   English   中英

如何從WordPress的博客頁面中排除最后一個帖子

[英]How to exclude last post from blog page in wordpress

我曾經在wordpress中寫過幾篇博客文章。 我已經完全更新了10個帖子,其完美顯示了10個帖子。

我的問題是

我只需要顯示9個帖子。 最近更新的帖子不應顯示在網站上。 我需要代碼來排除最新的帖子,即第10個帖子。 而且我需要將代碼放置在functions.php上。

誰能幫我。

提前致謝。

只需從admin pannel轉到您的settings ,然后單擊reading然后將blog post at most更改為9

或者通過編程,您可以嘗試像

 $latestPosts = new WP_Query( array(
                        'posts_per_page'            => 9, 
                        'orderby'                   => 'date',
                        'order'                     => 'DESC',
                      )); // end query

  while ($latestPosts->have_posts()) : $latestPosts->the_post();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM