Skip to content

Instantly share code, notes, and snippets.

@SmartWizardSolutions
Created January 17, 2014 03:52
Show Gist options
  • Save SmartWizardSolutions/8468149 to your computer and use it in GitHub Desktop.
Save SmartWizardSolutions/8468149 to your computer and use it in GitHub Desktop.
Style date in Genesis post info. This fixes a problem with post dates showing up as Jan 1st on all new posts from code previously found. CSS styles will need to be adjusted.
<?php
add_filter( 'genesis_post_date_shortcode', 'child_post_date_shortcode', 10, 2 );
/**
* Customize Post Date format and add extra markup for CSS targeting.
*/
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="date">%3$s</span> <span class="month">%4$s</span></span>',
$atts['label'],
get_the_time( 'D' ),
get_the_time( 'd' ),
get_the_time( 'M' ),
get_the_time( 'D-d-M\TH:i:sO' )
);
}
/*
Post Time and Date Display
---------------------------------------------------------------------------------------------------- */
.post-info {
margin: 0 0 5px;
padding: 5px 0 15px 0;
}
.post-info .time,
.post-info .time span {
color: #FFF;
font-family: sans-serif;
font-size: 16px;
font-size: 1.6rem;
font-weight: normal;
display: block;
text-align: center;
text-transform: uppercase;
width: 78px;
}
.post-info .time {
background: url(images/date-bg.jpg) no-repeat;
clear: both;
float: left;
width: 99px;
height: 81px;
position: relative;
top: -40px;
}
.post-info .date {
font-size: 35px !important;
font-size: 3.5rem !important;
font-weight: bold !important;
line-height: 1.0;
}
.post-info .day {
line-height: 1em;
margin-top: 8px;
}
.post-info .month {
margin-top: -3px;
text-transform: uppercase;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment