Skip to content

Instantly share code, notes, and snippets.

@rickrduncan
Last active December 22, 2015 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rickrduncan/6494748 to your computer and use it in GitHub Desktop.
Save rickrduncan/6494748 to your computer and use it in GitHub Desktop.
<?php
//* Do NOT include the opening php tag
/**
* Custom Post-Info with Google Rich Snippet support
* @link: https://gist.github.com/rickrduncan/6494748
* @author: Rick R. Duncan - www.rvamedia.com
* @credits: Greg Rickaby & Brad Dalton
*/
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
add_action( 'genesis_entry_header', 'rvam_post_info' );
function rvam_post_info() { ?>
<p class="entry-meta">
<time class="entry-time" datetime="<?php echo get_the_date( 'c' ); ?>" itemprop="datePublished"><?php echo get_the_date(); ?></time>
by
<span class="entry-author" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">
<a class="entry-author-link" rel="author" itemprop="url" href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>">
<span class="entry-author-name" itemprop="name"><?php the_author_meta( 'display_name' ); ?></span>
</a>
</span>
<span class="entry-comments-link">
<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 );
$modified_iso = the_modified_date( 'c', '', '', FALSE );
if ( $published_compare < $modified_compare ) {
echo '<time class="update-time" datetime="'. $modified_iso .'" itemprop="dateModified">(Updated: ' . $modified . ')</time>';
} ?>
</p>
<?php }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment