Skip to content

Instantly share code, notes, and snippets.

@GaryJones
Created February 10, 2012 09:16
Show Gist options
  • Save GaryJones/1787972 to your computer and use it in GitHub Desktop.
Save GaryJones/1787972 to your computer and use it in GitHub Desktop.
Add the year to the post date shortcode in Vintage theme.
<?php
add_filter( 'genesis_post_date_shortcode', 'custom_post_date_shortcode', 10, 2 );
/**
* Customize post date shortcode, to include year.
*
* @param string $output Existing post date shortcode output.
* @param array $atts Associative array of shortcode attributes.
*
* @return string Amended markup.
*/
function custom_post_date_shortcode( $output, $atts ) {
return sprintf(
'<span class="date time published" title="%5$s">%1$s<span class="day">%2$s</span> <span class="month">%3$s</span> <span class="year">%4$s</span></span>',
$atts['label'],
get_the_time( 'j' ),
get_the_time( 'M' ),
get_the_time( 'Y' ),
esc_attr( get_the_time( 'c' ) )
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment