Skip to content

Instantly share code, notes, and snippets.

@imelgrat
Last active February 14, 2019 22:03
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 imelgrat/d51859054884f040c19e94241e6a969e to your computer and use it in GitHub Desktop.
Save imelgrat/d51859054884f040c19e94241e6a969e to your computer and use it in GitHub Desktop.
Simple example showing how add the required tags to a WordPress theme in order to comply with the Google Search Console hEntry specifications.
<?php
/**
* Adds hatom tags to WordPress posts after the post title.
* Fixes Google Search Console hEntry specification errors.
*
* @link https://imelgrat.me/wordpress/hentry-fix-errors-wordpress/
*/
?>
<h2 class="post-title">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
<span class="entry-title"><?php the_title(); ?></span>
</a>
</h2>
<p>Author: <span class="vcard author"><span class="fn"><?php the_author(); ?></span></span></p>
<p>Posted on: <span class="date published"><?php the_time('Y/m/d'); ?></span></p>
<p>Updated: <span class="date updated"><?php echo get_the_modified_time('Y/m/d'); ?></span>)</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment