- This topic has 9 replies, 2 voices, and was last updated 6 years, 10 months ago by Tom.
-
AuthorPosts
-
November 10, 2017 at 10:40 am #421004John
Hey
I want to display Last Update date in my post and also google search snippet. For this, I added that CSS in my child theme stylesheet
————————————
.posted-on .updated {
display: inline-block;
}
.posted-on .published {
display: none;
}.posted-on .updated:before {
content: “Last updated: “;
}————————————
Everything was fine. Display Last Update Date in my posts and few days later after recrowl googlebot It will show also in google search snippet.
But from last 2-3 days, I notice show published date in google search snippet again but in my posts show Last Update date.
I mean Last Update date in google search not stay. After Few days display post published date.
Please check both screenshots for better understand my problem.
https://prnt.sc/h8t0rm
https://prnt.sc/h8t1o3How Can I solve this?
This issue is very important for my site.
Thanks
November 10, 2017 at 1:32 pm #421121JohnI check structure data “hatom” tab and find here is display
Screenshot Link – https://prnt.sc/h8vbyp
.posted-on .published {
display: none;
}This CSS property display none I mean hide published date from my website posts but not able to hide from structure data. Maybe for this reason on google search result show published date. Not sure, you are expert so you can find a proper reason.
If It is right point, how can I hide published date from structure data?
November 10, 2017 at 2:37 pm #421166JohnOne more info, I was using this rich snippet plugin
https://wordpress.org/plugins/all-in-one-schemaorg-rich-snippets/
can It cause problems?
I already deactivate this plugin and save again my post but still show both (publish/Update) date in structure data.
November 10, 2017 at 3:22 pm #421189TomLead DeveloperLead DeveloperIt looks like the last update date is displaying fine, and the structured data looks fine (the testing tool shows the last updated date just fine).
In this case I think it’s just up to Google to display the updated date over the published date – the best thing you can do is add structured data to the elements, which you’ve already done.
November 10, 2017 at 3:35 pm #421195JohnHey Tom
Is It possible to keep only Update date in markup?
I do not want to keep published date because I monitor my keyword on google last few days.
WHen shows Update date in search snippet keyword ranked up.
So I am very tense about this issue.
And I see few site html markup who do not use published date likehttps://www.cloudliving.com/seo-powersuite-review/
Is It any problem If I do not use published date?
Please send me code like my current format
Last Update Date | Author image | Author name
Thanks
November 10, 2017 at 8:15 pm #421306TomLead DeveloperLead DeveloperAre you currently using any code for the byline? I see you have the gravatar in there, so it would be best if I could see what you have already and edit it.
Let me know ๐
November 10, 2017 at 8:35 pm #421311JohnHey Tom
Here is the code
———————————————————-
add_filter( ‘generate_post_author_output’, ‘tu_add_author_gravatar’ );
function tu_add_author_gravatar() {
printf( ‘ <span class=”byline”>%1$s</span>’,
sprintf( ‘<span class=”author vcard” itemtype=”http://schema.org/Person” itemscope=”itemscope” itemprop=”author”>%4$s<span class=”author-name” itemprop=”name”>%3$s</span></span>’,
esc_url( get_author_posts_url( get_the_author_meta( ‘ID’ ) ) ),
esc_attr( sprintf( __( ‘View all posts by %s’, ‘generatepress’ ), get_the_author() ) ),
esc_html( get_the_author() ),
get_avatar( get_the_author_meta( ‘ID’ ) )
)
);}
November 10, 2017 at 10:40 pm #421352TomLead DeveloperLead DeveloperTry adding this function:
add_filter( 'generate_post_date_output', 'tu_no_published_date' ); function tu_no_published_date() { $time_string = ''; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string .= '<time class="updated" datetime="%1$s" itemprop="dateModified">%2$s</time>'; } $time_string = sprintf( $time_string, esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) ); printf( '<span class="posted-on">%1$s</span>', sprintf( '<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>', esc_url( get_permalink() ), esc_attr( get_the_time() ), $time_string ) ); }
November 11, 2017 at 1:20 am #421428JohnWow! It works like a charm. You are really helpful.
Thank you so much, Tom
November 11, 2017 at 8:30 am #421756TomLead DeveloperLead DeveloperYou’re very welcome ๐
-
AuthorPosts
- You must be logged in to reply to this topic.