Date modified shortcode
add_filter( 'genesis_post_info', 'add_modified_date_post_info' );
function add_modified_date_post_info($post_info) {
$post_info = 'Updated: [modified_date] by [post_author_posts_link] [post_comments] [post_edit]';
return $post_info;
}
add_shortcode( 'modified_date', 'wpsites_modified_date_shortcode' );
/**
* Generates the modified date of the post.
* @author Brad Dalton
* @example http://wpsites.net/
* @copyright 2014 WP Sites
*/
function wpsites_modified_date_shortcode( $atts ) {
$defaults = array(
'after' => '',
'before' => '',
'format' => get_option( 'date_format' ),
'label' => '',
);
$atts = shortcode_atts( $defaults, $atts, 'modified_date' );
$display = ( 'relative' === $atts['format'] ) ? genesis_human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ) . ' ' . __( 'ago', 'genesis' ) : get_the_modified_date( $atts['format'] );
if ( genesis_html5() )
$output = sprintf( '<time %s>', genesis_attr( 'entry-time' ) ) . $atts['before'] . $atts['label'] . $display . $atts['after'] . '</time>';
else
$output = sprintf( '<span class="date published time" title="%5$s">%1$s%3$s%4$s%2$s</span> ', $atts['before'], $atts['after'], $atts['label'], $display, get_the_modified_date( $d ) );
return apply_filters( 'genesis_post_date_shortcode', $output, $atts );
}