- This topic has 5 replies, 2 voices, and was last updated 7 years ago by Tom.
-
AuthorPosts
-
April 21, 2017 at 3:45 am #308475Enrico
Hi Tom,
I used your code https://gist.github.com/generatepress/67fb28af5c8be3103290 for a long time.Google’s Structured testing tool test was always with 0 errors and 0 warning. But in the Google webmaster console I had always errors in Structured data: missing author errors in category and blog pages.
I finally understood the problem. With you code all the author information in Hatom was removed in category and blog. Author information was present, but only in Creativework data, this is why it took me so long to understand the problem.
hatom should have this information:
author
@type
hcard
fn
Enrico F
url
https://sitename.it/author/ef/
nWith you code this information was removed. I think you should remove only the url not the fn.
Regards
EnricoApril 21, 2017 at 10:07 am #308613TomLead DeveloperLead DeveloperCan you try this updated code?: https://gist.github.com/generatepress/67fb28af5c8be3103290
April 21, 2017 at 11:09 am #308638EnricoThanks a lot Tom, I tested it and this code don’t remove the hatom for author. it removes correctly only the links to author page in categories, blog and posts.
The old code was removing also the date link in categories, blog and posts. Is it possible to remove also the date links?
April 21, 2017 at 11:32 am #308640TomLead DeveloperLead DeveloperTry this function:
add_filter( 'generate_post_date_output','tu_remove_date_link' ); function tu_remove_date_link() { $time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>'; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string .= '<time class="updated" datetime="%3$s" itemprop="dateModified">%4$s</time>'; } $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) ); printf( '<span class="posted-on">%s</span>', $time_string ); }
April 21, 2017 at 11:57 am #308663EnricoThanks a lot Tom! I added also this code and apparently everything is working. Now also the dates have no links.
There is something that can have problems with this code and that I have to check more carefully or is the same old code to remove dates links?
April 21, 2017 at 7:56 pm #308780TomLead DeveloperLead DeveloperThese functions I just provided are the latest/greatest way to do it – way better than overwriting the entire function 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.