Display Posts includes a parameter for displaying the post date:
Shortcode
[display-posts include_date="true" posts_per_page="1"]
Result
- Display posts as a select dropdown (2/8/2021)
Date Format
You can customize the date format to any format you like (see Formatting Date and Time). For instance, this will include the time along with the date:
Shortcode
[display-posts include_date="true" date_format="F j, Y g:ia" posts_per_page="1"]
Result
- Display posts as a select dropdown February 8, 2021 7:37am
Customize text around date and time
If you’d like to customize the text that appears before, between, or after the date and time, you’ll need to use the output filter.
In the below example, we are adding a new parameter for the time, and it includes “at” before the actual time is displayed.
Shortcode
[display-posts include_date="true" include_time="true" date_format="F j, Y" posts_per_page="1"]
Result
- Display posts as a select dropdown February 8, 2021 at 7:37 am
This code snippet goes in a core functionality plugin or Code Snippets.