Skip to content

Instantly share code, notes, and snippets.

@GaryJones
Last active December 17, 2015 11:29
Show Gist options
  • Save GaryJones/5602296 to your computer and use it in GitHub Desktop.
Save GaryJones/5602296 to your computer and use it in GitHub Desktop.
Amended post date styling, including the year
<?php
add_filter( 'genesis_post_date_shortcode', 'child_post_date_shortcode', 10, 2 );
/**
* Customize Post Date format and add extra markup for CSS targeting.
*
* Includes the year as well.
*
* @author Gary Jones
* @link http://code.garyjones.co.uk/style-post-info/
*
* @param string $output Current HTML markup.
* @param array $atts Attributes.
*
* @return string HTML markup.
*/
function child_post_date_shortcode( $output, $atts ) {
return sprintf(
'<span class="date time published" title="%4$s">%1$s<span class="day">%2$s</span> <span class="month">%3$s</span> <span class="month">%5$s</span></span>',
$atts['label'],
get_the_time( 'j' ),
get_the_time( 'M' ),
get_the_time( 'Y-m-d\TH:i:sO' ),
get_the_time( 'Y' )
);
}
Copy link

ghost commented Sep 3, 2015

The last class="month"should be class="year"if I'm not mistaken :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment