Latest Tech and Tips

How to Display a List of Last Updated Posts in WordPress


At WPBeginner, we reveal last altered day rather of initial released day for all of our write-ups. We assume it misbehaves concept to get rid of days from your WordPress post. If you are making use of last altered day, after that you may desire to program a list of your lately updated posts on your website. In this post, we will certainly reveal you how to display a list of last updated postsin WordPress

Each time you upgrade a article, WordPress shops the day as well as time of that upgrade in the posts table as last updated day. We will certainly reveal you how to develop a custom-made WordPress inquiry to list your most lately updated write-ups.

Copy as well as paste this code in a site-specific plugin or your style’s functions.php data.

feature wpb_lastupdated_posts() {

//Query Arguments
$ lastupdated_args = range(.
' orderby' => > 'customized',.
' ignore_sticky_posts' => > '1'.

//Loop to display 5 lately updated posts.
$ lastupdated_loop = brand-new WP _Query( $lastupdated_args );.
$ counter = 1;.
$ string.= '<< ul>>';.
while( $lastupdated_loop->> have_posts() && & & $counter < 5):$ lastupdated_loop- > the_post();.
$ string.= '<< li><>  '. get_the_title( $lastupdated_loop->> article->> ID ). '< ('. get_the_modified_date().') <';.
$ counter++;.
$ string.= '<';.
return $string;.

// include a shortcode.
add_shortcode(' lastupdated-posts', 'wpb_lastupdated_posts');.

"' . get_permalink( $lastupdated_loop->post->ID ) . '"'s all. a if you desire a display last updated posts 

That your style's layout documents, after that you can utilize it such as this:Now