Display time after post date

Display Posts includes a parameter for displaying the post date:

Shortcode

[display-posts include_date="true" posts_per_page="1"]

Result

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

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

This code snippet goes in a core functionality plugin or Code Snippets.

Published by Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributor to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Leave a comment

Your email address will not be published. Required fields are marked *