0
A
回答
0
您可以使用query_posts
例如,在主頁上,您通常會看到最新的10個帖子。如果你只想顯示3個帖子(並且不關心分頁),你可以使用query_posts()像這樣:
query_posts('posts_per_page = 3');
希望得到這個幫助!
3
WordPress有一個內置函數來獲取最近的帖子。
wp_get_recent_posts($args) ;
$args
是您需要傳遞的參數。爲了取得三發最新發布的帖子,你可以不喜歡它:
$args = array('numberposts' => 3, 'post_status' => 'publish');
$recent_posts = wp_get_recent_posts($args) ;
print_r($recent_posts);
你可以得到更多的信息這個環節上wp_get_recent_posts
希望這有助於你:)
相關問題
- 1. 在表格中輸出最近的Wordpress帖子,在tr標籤中包含2個帖子?
- 2. 最近/最近一個月的帖子
- 3. 最近的帖子凌亂的wordpress
- 4. WordPress首先最近的帖子
- 5. Wordpress最近的帖子/項目
- 6. WordPress的 - 顯示從特定類別3最近的帖子
- 7. 突出在最近的帖子邊欄現任職務,WordPress的
- 8. PHP - WordPress的 - 8個最近的帖子,從最古老的
- 9. PHP的WordPress的 - 最新的3帖子
- 10. 爲WordPress帖子輸出JSON
- 11. 在Wordpress中禁用評論,最近的帖子,檔案,部分
- 12. 列出最近的帖子和頁面
- 13. MySql Query for WordPress最近的帖子需要鏈接到個人帖子
- 14. 顯示最近的帖子在第4個帖子
- 15. 顯示最近評論的帖子上個月wordpress
- 16. WordPress的帖子最後的帖子
- 17. 獲取最近的帖子
- 18. 圖片在WordPress的Q和A主題的最近帖子
- 19. 我最近在WordPress的帖子之間的空間
- 20. 在靜態HTML頁面顯示最近的WordPress的帖子
- 21. Ajax加載更多按鈕在最近的帖子插件wordpress
- 22. 在Wordpress 3中安排更新帖子?
- 23. WordPress的 - 在所有帖子上輸出sidebar.php中的相關帖子
- 24. WordPress的 - 獲取最近的帖子的簡短描述
- 25. WordPress的評論框是不可見的最近的帖子
- 26. 幫助編輯最近的帖子WordPress的插件一次
- 27. 訂購最近評論的WordPress的帖子
- 28. 如何添加縮略圖到最近的帖子,WordPress的
- 29. WordPress的顯示重複最近的帖子
- 30. 紅寶石,WordPress的:看了最近的帖子