2016-11-18 82 views
-1

我想顯示列表發佈最後更新但不發佈最後發佈。同樣,如何顯示列表發佈最後發佈但不顯示上次更新?WordPress的顯示帖子僅修改

+1

歡迎StackOverflow上。請注意,這不是免費的 代碼寫入服務,但我們非常樂意幫助其他程序員 (和有志之士)編寫自己的代碼。請閱讀幫助主題 [如何詢問一個好的 問題](http://stackoverflow.com/help/how-to-ask)。之後, 請使用您所寫的代碼更新您的問題到目前爲止 爲了完成您希望實現的任務。 –

+0

刪除一些不需要的額外文本。 – rlandster

回答

0
function display_updated_posts() { 

/* These are the arguments to pass into WP_Query */ 
$modifiedposts_args = array('orderby' => 'modified', 'ignore_sticky_posts' => '1'); 

$modifiedposts_loop = new WP_Query($modifiedposts_args); 
$counter = 1; 
echo '<ul>'; 
while($modifiedposts_loop->have_posts() && $counter < 5) { 
$modifiedposts_loop->the_post(); 
echo '<li><a href="' . get_permalink($modifiedposts_loop->post->ID) . '"> ' 
.get_the_title($modifiedposts_loop->post->ID) . '</a> (' 
. get_the_modified_date() .') </li>'; 
$counter++; 
} 
echo '</ul>'; 
wp_reset_postdata(); 
} 

指這個,我希望這對您有所幫助,

http://www.wpbeginner.com/wp-tutorials/how-to-display-a-list-of-last-updated-posts-in-wordpress/

+0

謝謝。但是它會顯示兩個新的帖子.... :( – miken

+0

你檢查了那個鏈接嗎? –

+0

發送給我的網站的網址,如果有可能的話 –