How to add Date block left side of Post Title in WP Genesis Theme

5.00 Rating, Out of: 5 Votes: 11 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...

How to Add date block before post title in WordPress

Now a days I have seen many blog shows date in left side of post title, So i have tried to add same style with Genesis child theme. So here is the solution now you also can do it.. Just need to do these 2 changes.

# 1 change on function.php file.


/** Add date block before post title */
add_action( 'genesis_before_post_title', 'custom_post_date' );
function custom_post_date() {
	if ( ! is_page() ) {
		echo '<div class="post-date">';
		echo do_shortcode( '[post_date format="M"]' );
		echo "<p>".do_shortcode( '[post_date format="d"]' );
		echo '</p></div><!-- end .post-date -->';

# 2 change on css file.

.post-date {

background-color: #333335;
color: #fff;
float: left;
font-family: “Century Gothic”, AppleGothic, Arial, sans-serif;
font-size: 12px;
line-height: 20px;
margin: 0 10px 5px 0;
text-align: center;
width: 50px;
.post-date p{ font-size: 20px; color: #fff; font-weight:bold;}