In your WordPress updated articles were added to the label is a good choice,So you can be notified to search engines when your article is the updated。Other,Today, search engines and the latest number of the recently updated content ratings as one of the items,Then add your WordPress articles which updated the label becomes necessary。
Structured Data Errors
When using Google Webmaster Tools site page analysis,You will find three crawl errors,Each of these three seems to be a system using a WordPress blog sites will encounter,One of them is about the updated class of,Be called:
missing updated class
The cause of the error is caused by the lack of in your article page update information,We can know the updated data segment is required by Google's manual,Published but it is not necessary! Other,updated entry-title and the two fields requires two class,But if you both write,Then congratulations,Search engines will ignore the content of ╮ out updated(╯▽╰)╭
so,The best way is to keep only Updated。
Make your blog page display the date the label is updated
This approach based on the theme you are using ever-changing,Especially if you use a third-party themes and not standardized,Oh more people。so,Here it,Twenty routing theme comes with WordPress Fourteen example,Of course,This is because the current (or at least the time of this writing) off the grid is using Twenty Fourteen。
For any topic yet,Routing is recommended that you use the "sub-theme" approach to theme changes,This avoids a great extent on the theme update when overwrite your changes,For example, statistical code,For example, now we have to do to modify。
otherwise,Two months later, who knows what you changed。Usage (on sub-theme is actually very simple,The official Chinese version will now have,Tells in great detail,Specific links could see footer "Further Reading"。)
The theme for the Twenty Fourteen,It defines this regard is in fact inc / template-tags.php file
Specific code excerpt me down:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
if ( ! function_exists( 'twentyfourteen_posted_on' ) ) : /** * Print HTML with meta information for the current post-date/time and author. * * @since Twenty Fourteen 1.0 * * @return void */ function twentyfourteen_posted_on() { if ( is_sticky() && is_home() && ! is_paged() ) { echo '<span class="featured-post">' . __( 'Sticky', 'twentyfourteen' ) . '</span>'; } // Set up and print post meta information. printf( '<span class="entry-date"><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s">%3$s</time></a></span> <span class="byline"><span class="author vcard"><a class="url fn n" href="%4$s" rel="author">%5$s</a></span></span>', esc_url( get_permalink() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), get_the_author() ); } endif; |
of course,We can not go directly to modify the file - although it can achieve immediate effect,But once the update,I am afraid not so good about the。
so,Characteristics we use to overwrite the sub-theme of this function。It has a function of covering documents,functions.php is one of them,Specific reference is recommended that you go to official documents,Only here the route description,This file is in the definition of sub-themes are a few more special,It is not just a direct replacement for the parent theme files,But it may be additional functions and replace function on the parent topic。
Changes about three parts:
- Updated display - Edit the functions.php get_the_date Function with get_the_modified_date Substitute。 In this way you will publish date below the article title change last updated。
- Updated Class - Add to updated class to tag page,So that error on wood it。
- Show Updated Text - Displays the latest updates words in front of your date,Province to the release date and the time difference between the latest review date three or four years -
Below is the modified functions:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
if ( ! function_exists( 'twentyfourteen_posted_on' ) ) : /** * Print HTML with meta information for the current post-date/time and author. * * @since Twenty Fourteen 1.0 * * @return void */ function twentyfourteen_posted_on() { if ( is_sticky() && is_home() && ! is_paged() ) { echo '<span class="featured-post">' . __( 'Sticky', 'twentyfourteen' ) . '</span>'; } // Set up and print post meta information. printf( '最新更新 <span class="entry-date updated"><a href="%1$s" rel="bookmark"><time class="entry-date updated" datetime="%2$s">%3$s</time></a></span> <span class="byline"><span class="author vcard"><a class="url fn n" href="%4$s" rel="author">%5$s</a></span></span>', esc_url( get_permalink() ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), get_the_author() ); } endif; |
This article is not original,Code and content are referenced,See the original page "Further Reading"。
Extended reading
How to Add Updated Date to WordPress Articles
Original article written by LogStudio:R0uter's Blog » How to fix missing updated class issue in WordPress
Reproduced Please keep the source and description link:https://www.logcg.com/archives/827.html
I tried your method,I want to do it. Thank you ~
I ask you to use this approach must be the subject of 2014,Else you need to make changes to modify ~ I used to use allinone SEO,Yost now use the SEO feeling good,Because of the subject matter I've commented out code,But google is still not being given again。You can also try。