Skip to content

Instantly share code, notes, and snippets.

@laranz
Created August 30, 2017 14:40
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 laranz/42b240ca0ba9e085445d6910a3b4a689 to your computer and use it in GitHub Desktop.
Save laranz/42b240ca0ba9e085445d6910a3b4a689 to your computer and use it in GitHub Desktop.
// auto insert hidden hatom data in single posts
add_filter('the_content', 'hatom_data_in_content', 100);
function hatom_data_in_content($content) {
if (is_single()) $content .= get_hatom_data();
return $content;
}
// returns hidden hatom data for current post
function get_hatom_data() {
$html = '<div class="hatom-extra" style="display:none;visibility:hidden;">';
$html .= '<span class="entry-title">'.get_the_title().'</span>';
$html .= '<span class="updated"> '.get_the_modified_time('F jS, Y').'</span>';
$html .= '<span class="author vcard"><span class="fn">'.get_the_author().'</span></span></div>';
return $html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment