Display List of Updated Posts in WordPress image

Do you want to show last updated posts instead of displaying the actual publish date? Here are the easy ways to Show a List of Last Updated Posts in WordPress. Read the complete article and display list of updated posts in WordPress.

How to Show a List of Last Updated WordPress Posts?

Browsing the internet for getting an easy way to display a list of your recently updated WordPress posts on your website will make you feel stress. Don’t stress yourself, you are at the right place where you can find the simple methods to show last updated WordPress Posts.

Show a List of Last Updated Posts in WordPress image

Here we have provided 2 different methods for displaying recently updated WordPress Posts. Follow one of those methods and learn how to show last updated WordPress Posts.

Check Latest WordPress Backup Plugins

Display a List of Recently Updated WordPress Posts through Code

Every time when you update a Post, WordPress stores the time and date of that update in WordPress Posts table as last updated date. Here we have provided the simple coding method for displaying list of last updated Posts in WordPress. Follow the given process and show recently updated posts list.

  • Login to your WordPress admin area.
  • Click on Editor option from Appearance Section.
  • Open functions.php file.
  • Next, copy the given code.
  • Paste the copied code into functions.php file.
  • Next, click on the Update File Button.
function wpp_lastupdated_posts() { 

// Query Arguments
$lastupdated_args = array(
'orderby' => 'modified',
'ignore_sticky_posts' => '1'
);

//Loop to display 5 recently updated posts
$lastupdated_loop = new WP_Query( $lastupdated_args );
$counter = 1;
$string .= '<ul>';
while( $lastupdated_loop->have_posts() && $counter < 5 ) : $lastupdated_loop->the_post();
$string .= '<li><a href="' . get_permalink( $lastupdated_loop->post->ID ) . '"> ' .get_the_title( $lastupdated_loop->post->ID ) . '</a> ( '. get_the_modified_date() .') </li>';
$counter++;
endwhile; 
$string .= '</ul>';
return $string;
wp_reset_postdata(); 
} 

//add a shortcode
add_shortcode('lastupdated-posts', 'wpp_lastupdated_posts');
  • Now, the List of Last updated posts will display on the screen.

If you want to show a list of recently updated posts in your WordPress theme’s template files, then you have to use this given code.

<?php 
if (function_exists(wpb_lastupdated_posts)) : 
wpb_lastupdated_posts();
endif;
?>

For displaying last updated WordPress posts in pages, posts, and widgets, you have to use the given short code.

[lastupdated-posts]

Show a List of Last Updated Posts in WordPress using a Plugin

The Display Posts Shortcode is one of the Best WordPress Plugins used for displaying recently updated posts list. Follow the given process and configure Display Posts Shortcode on your WordPress website.

  • First Login to your WordPress admin area.
  • Now, install Display Posts Shortcode on your WordPress.
    • How to install Display Posts Shortcode WordPress Plugin?
      • You can install Display Posts Shortcode plugin in various ways. Here we have described the installation process through WordPress Plugin Search. This is the easiest way when compared to other methods.
      • Click on the Plugin option.
      • Next, click on the Add New option from the Plugins Page in your WordPress.
      • Enter Display Posts Shortcode in the search Plugin field.
      • Display Posts Shortcode plugin appears on the screen.
      • Click on the Install Now Button on that Display Posts Shortcode WordPress plugin.
      • Now, Display Posts Shortcode is successfully installed on your website.
      • Next, click on the Activate Button from Display Posts Shortcode Plugin.
  • After successful installation, open a WordPress post or page where you want to display the list of last updated posts.
  • Next, paste the given short code into that WordPress Post or page.
[display-posts posts_per_page=”10″ include_date=”true” order=”DESC” orderby=”modified”]
  • Now, the List of Last updated WordPress posts will display on the screen.

If you want to use the WordPress default text widget, then you can use the given process to Show a List of Last Updated Posts in WordPress.

  • Go to your WordPress Admin Area.
  • Click on Editor option under Appearance section.
  • Copy the given code.
add_filter(‘widget_text’, ‘do_shortcode’)
  • Paste the given code into functions.php file.
  • Next, click on update file button.
  • Now, the list of last updated posts will display on the screen.
Download Best Responsive WordPress Themes for Job Portal sites

We hope this article is useful for you to show a List of Last Updated Posts in WordPress. You can check our WordPress Tutorial for improving WordPress Security.

LEAVE A REPLY