Created
July 7, 2016 13:48
-
-
Save eddt/c107dfc4366469bd6eb83a5e77e3a5f4 to your computer and use it in GitHub Desktop.
Google Search Console Hentry error fix
This file contains 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
<? php | |
//Fix for missing author, entry title, and updated in GSC | |
////add hentry data | |
function add_hentry_data($content) { | |
$t = get_the_modified_time('F jS, Y'); | |
$author = get_the_author(); | |
$title = get_the_title(); | |
if (is_home() || is_singular() || is_archive() ) { | |
$content .= '<div class="hentry-extra" style="display:none;visibility:hidden;"><span class="entry-title">'.$title.'</span> was last modified: <span class="updated"> '.$t.'</span> by <span class="author vcard"><span class="fn">'.$author.'</span></span></div>'; | |
} | |
return $content; | |
} | |
add_filter('the_content', 'add_hentry_data'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should add this to every function script!