Created
August 29, 2013 12:35
-
-
Save srikat/6377497 to your computer and use it in GitHub Desktop.
Adding date shortcodes before entry content for articles in Genesis using "genesis_before_entry_content" action. http://sridharkatakam.com/how-to-add-circular-date-for-posts-in-genesis/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'genesis_before_entry_content','sri_add_date'); | |
function sri_add_date () { | |
if (is_home() || is_archive()) { ?> | |
<div class="my-date"> | |
<span class="my-date-day"><?php echo do_shortcode("[post_date format='j']"); ?></span> | |
<span class="my-date-month"><?php echo do_shortcode("[post_date format='M']"); ?></span> | |
</div> | |
<?php } | |
} | |
//* Customize the post info function | |
add_filter( 'genesis_post_info', 'sp_post_info_filter' ); | |
function sp_post_info_filter($post_info) { | |
if (is_home() || is_archive()) { | |
$post_info = 'by [post_author_posts_link] [post_comments] [post_edit]'; | |
return $post_info; | |
}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.home .content article, | |
.archive .content article { | |
position: relative; | |
} | |
.home .content article .my-date, | |
.archive .content article .my-date { | |
position: absolute; | |
top: -25px; | |
left: -25px; | |
background-color: rgba(42, 117, 213, 0.5); | |
-webkit-border-radius: 28px; | |
-moz-border-radius: 28px; | |
border-radius: 28px; | |
color: #FFFFFF; | |
font-weight: bold; | |
font-size: 11px; | |
height: 56px; | |
letter-spacing: 1px; | |
line-height: 5.4; | |
text-align: center; | |
text-transform: uppercase; | |
width: 56px; | |
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); | |
} | |
@media only screen and (max-width: 500px) { | |
.home .content article, | |
.archive .content article { | |
padding-bottom: 6rem; | |
} | |
.home .content article .my-date, | |
.archive .content article .my-date { | |
left: 0; | |
top: -60px; | |
} | |
} | |
@media only screen and (max-width: 800px) { | |
.home .content article .my-date, | |
.archive .content article .my-date { | |
right: 0; | |
left: auto; | |
top: 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment