I recently spent several hours figuring out how to list recently modified posts in WordPress. I tried at least 4 plugins, none of which did what I wanted: create a simple unordered list of recently modified posts. But I finally found a free plugin with dozens of display options that does it with ease: Display Posts Shortcode by Bill Erickson.
The following tutorial explains how to create a list of recently modified posts and display them in a post, page, or widget. Also, with a small tweak, you can display recently modified pages.
Note: For an extensive list of shortcode options and examples, see the Display Posts Shortcode documentation.
To List Recently Modified Posts in a Post or Page
- Install the Display Posts Shortcode plugin.
Instructions for Installing WordPress plugins. - Open a post or page where you want the list to appear.
- Insert the following shortcode into the Visual editor and click save.
[display-posts posts_per_page="10" include_date="true" order="DESC" orderby="modified"]
If you want to use the default WordPress Text widget, add the following code to your theme’s functions.php file to allow the Text widget to process shortcode:
add_filter(‘widget_text’, ‘do_shortcode’);
- Click Save and then view the post or page. You should see an unordered list of 10 recently modified posts with the most recently modified post on top.
To Display a List or Recently Updated Posts in a Widget
It is also possible to display a list of recently updated posts in a widget.
- Go to Appearance > Widgets.
- Click the Visual Editor widget.
Note: You will need the Black Studio TinyMCE Widget Visual Editor widget plugin to do this.
If you want to use the default WordPress Text widget, add the following code to your theme’s functions.php file to allow the Text widget to process shortcode:
add_filter(‘widget_text’, ‘do_shortcode’);
Instructions for Installing WordPress plugins. - Select the Widget area you want to use and click Add Widget.
- Optional: Add a title to the widget; for example, Recently Updated Stories.
- Paste the following shortcode into the Text or Visual Editor and click Save:
- WPForms Not Sending Notifications (4/16/2020)
- WooCommerce Terms and Conditions Example (5/22/2017)
- Add Terms and Conditions WooCommerce (2/9/2020)
- Fix WordPress AMP Validation Errors (7/12/2019)
- Add Retina Logo to a Genesis Template (4/22/2014)
- Hide WordPress Custom Fields on Password Protected Genesis Pages (8/30/2016)
- Add a Message at Top or Bottom of WooCommerce Checkout Page (12/14/2018)
- Flexbox Justify-Content Doesn’t Work – Space Between or Space Around (12/2/2018)
- How to Link to a PDF in WordPress (12/11/2018)
- Use the Classic Editor with Gutenberg Block Editor (1/13/2019)
- Go to a page on your site to view a page. You should see a list of your recently updated posts.
Note: If you don’t see the list, make sure the widget is configured to display on the page you are viewing.
To List Recently Modified Pages in WordPress
The procedure for listing recently modified pages in a post, page, or widget is the same as for posts except you need to add post_type=”page” to the shortcode I already used:
Change the Output and Style of the Post List
You can easily change the output and container of the list. The default output of the list is and unordered list, but you can change that to an ordered list or to divs. For example,
or
Also note that the output, unordered list, ordered list, or div, will use the existing formatting of your template. But you can change the styling to whatever you want using css rules for the class display-posts-listing.
Final Notes
You are not stuck with the shortcode example I have used in this tutorial. There are dozens of examples in the Display Posts Shortcode documentation and the documentation is excellent. Do be afraid to experiment until you get what you want. For example, you can create post lists for custom post types, or show posts from a specific category or tag.
The Display Posts Shortcode is a powerful and flexible plugin, but it requires just a little effort to get exactly what you want. And this plugin is the easiest way to almost endless types of post list without writing any PHP code.
Jenny says
Hey, your post is displaying the list that is created by the short code but not the short code itself, which is what I needed. I use the plugin myself and I knew I could do this very thing, but I would just want the text to use. It’s an amazing plugin and I’ve spent many hours tweaking lists. but I guess I’ll have to dig into the documentation again to figure this one out. Sorry, but these examples do me no good if I can’t get the code itself.
taponitrof says
OK. I fixed it. Thanks.