Created
June 5, 2012 21:45
-
-
Save gregrickaby/2878257 to your computer and use it in GitHub Desktop.
Custom Post-Info with Google Rich Snippet support (Thesis)
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( 'thesis_hook_byline_item', 'custom_byline' ); | |
/** | |
* Custom Post-Info with Google Rich Snippet support | |
* | |
* @author Greg Rickaby | |
* @since 1.0.0 | |
*/ | |
function custom_byline() { | |
if ( is_page() ) | |
return; // don't do post-info on pages ?> | |
<div class="post-info"> | |
<span class="date published time"> | |
<time class="entry-date" itemprop="startDate" datetime="<?php echo get_the_date( 'c' ); ?>" pubdate><?php echo get_the_date(); ?></time> | |
</span> By | |
<span class="author vcard"> | |
<a class="fn n" href="<?php echo get_the_author_url( get_the_author_meta( 'ID' ) ); ?>" title="View <?php echo get_the_author(); ?>'s Profile" rel="author me"><?php the_author_meta( 'display_name' ); ?></a> | |
</span> | |
<span class="post-comments">· <a href="<?php the_permalink() ?>#comments"><?php comments_number( 'Leave a Comment', '1 Comment', '% Comments' ); ?></a></span> | |
<?php // if the post has been modified, display the modified date | |
$published = get_the_date( 'F j, Y' ); | |
$modified = the_modified_date( 'F j, Y', '', '', FALSE ); | |
$published_compare = get_the_date( 'Y-m-d' ); | |
$modified_compare = the_modified_date( 'Y-m-d', '', '', FALSE ); | |
if ( $published_compare < $modified_compare ) { | |
echo '<span class="updated"><em>· (Updated: ' . $modified . ')</em></span>'; | |
} ?> | |
</div> | |
<?php } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment