This tutorial shows you how to :
- Create a custom shortcode for the post date which you can add in the entry meta/ post info. This method requires 2 code snippets.
- Modify the default functionality of the post_date shortcode using a filter so you can customize the HTML output in the source code and how its displayed on the front end. This method only requires 1 code snippet.
Shows the modified post_date shortcode produces a custom post date in the post info. Also shows the HTML in the source code which includes the time tag and datepublished schema.
Tested using the Wellness Pro child theme by StudioPress however will work in every Genesis child theme.
Both methods can produce exactly the same result in the source code which is this :
<time class="entry-time" itemprop="datePublished" datetime="2018-02-09T17:15:56+00:00">PUBLISHED ON 2018-02-09 | New York Times</time>
Includes a time element with a machine-readable datetime attribute.
Method 1 : Custom Shortcode
Creates a custom shortcode and then uses the genesis_post_info filter to add the custom shortcode to the entry meta in the entry header. Copy & paste the first 2 code snippets from the functions file in the download folder to your child themes functions file.
Method 2 : Filter post_date Shortcode
Uses the genesis_post_date_shortcode filter to modify the default functionality for the post_date shortcode. Copy & paste the 3rd code snippet from the functions file in the download folder to your child themes functions file.
Register or login to access the code snippets in the download folder :