You appear to be a bot. Output may be restricted
Description
Produce the post last modified date.
Supported shortcode attributes are:
- after (output after date, default is empty string),
- before (output before date, default is empty string),
- format (date format, default is value in date_format option field),
- label (text following 'before' output, but before date).
Output passes through genesis_post_modified_date_shortcode
filter before returning.
Usage
$string = genesis_post_modified_date_shortcode( $atts );
Parameters
- $atts
- ( array|string ) required – Shortcode attributes. Empty string if no attributes.
Returns
string Output for post_modified_date
shortcode.
Source
File name: genesis/lib/shortcodes/post.php
Lines:
1 to 41 of 41
function genesis_post_modified_date_shortcode( $atts ) { $defaults = [ 'after' => '', 'before' => '', 'format' => get_option( 'date_format' ), 'label' => '', 'relative_depth' => 2, ]; $atts = shortcode_atts( $defaults, $atts, 'post_modified_date' ); if ( 'relative' === $atts['format'] ) { $display = genesis_human_time_diff( get_the_modified_time( 'U' ), current_time( 'timestamp' ), $atts['relative_depth'] ); // phpcs:ignore WordPress.DateTime.CurrentTimeTimestamp.Requested -- safe to compare WP to WP timestamps, see https://make.wordpress.org/core/2019/09/23/date-time-improvements-wp-5-3/#comment-37319. $display .= ' ' . __( 'ago', 'genesis' ); } else { $display = get_the_modified_time( $atts['format'] ); } $output = sprintf( '<time %s>', genesis_attr( 'entry-modified-time' ) ) . $atts['before'] . $atts['label'] . $display . $atts['after'] . '</time>'; /** * Change the output of the post_modified_date shortcode. * * @since 2.1.0 * * @param string $output Markup containing post last modification date. * @param array $atts { * Shortcode attributes after merging with default values. * * @type string $after Output after date. * @type string $before Output before date. * @type string $format Date format, could be 'relative'. * @type string $label Text following 'before' output, but before date. * } */ return apply_filters( 'genesis_post_modified_date_shortcode', $output, $atts ); }