function genesis_post_date_shortcode( $atts ) { $defaults = [ 'after' => '', 'before' => '', 'format' => get_option( 'date_format' ), 'label' => '', 'relative_depth' => 2, ]; $atts = shortcode_atts( $defaults, $atts, 'post_date' ); if ( 'relative' === $atts['format'] ) { $display = genesis_human_time_diff( get_the_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_time( $atts['format'] ); } $output = sprintf( '<time %s>', genesis_attr( 'entry-time' ) ) . $atts['before'] . $atts['label'] . $display . $atts['after'] . '</time>'; return apply_filters( 'genesis_post_date_shortcode', $output, $atts ); }