Structured Data Errors Showing in Google Search Console (Webmaster Tools)

Using rich snippet tool from Google I have noticed that some things are missing from this awesome template causing the below errors.
Errors Listed:
Missing: author
Missing: entry-title
Missing: updated

These errors do cause content to drop out of google results and do measurably decrease ranking. Its been several years since Google expects this info to exist and the penalties are higher now.

I have seen several work arounds but I can’t find the proper php’s to modify and I don’t know how to create a child theme.

Considering it’s been such a long time that google is requiring this info will Sydney be updated? It looks like a small fix for a pro.

If not, can anyone give me specific directions on exactly what edits to create and where to put them and if a child theme is required how to do it?

I appreciate any help. Below is an article explaining the issue.

Thanks!

It doesn’t look like the single.php holds the settings required, hense i’m lost on where to look.

See here:

Thanks again!

To fix it, you should edit some files in the child theme.

  1. Download the Sydney child theme here
  2. Copy the content-single.php file from parent theme’s folder to the child theme’s. So you will have sydney-child/content-single.php
  3. Change this line of code <?php the_title( '<h1 class="title-post">', '</h1>' ); ?> to <?php the_title( '<h1 class="title-post entry-title">', '</h1>' ); ?>
  4. Paste the following function into the child theme’s functions.php file

/**
 * Prints HTML with meta information for the current post-date/time and author.
 */
function sydney_posted_on() {
	$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
		$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%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() )
	);

	$posted_on = sprintf(
		_x( 'Posted on %s', 'post date', 'sydney' ),
		'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
	);

	$byline = sprintf(
		_x( '%s', 'post author', 'sydney' ),
		'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
	);

	echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>';

	if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
		echo '<span class="comments-link">';
		comments_popup_link( __( 'Leave a comment', 'sydney' ), __( '1 Comment', 'sydney' ), __( '% Comments', 'sydney' ) );
		echo '</span>';
	}

	$categories_list = get_the_category_list( __( ', ', 'sydney' ) );
	if ( $categories_list && sydney_categorized_blog() ) {
		printf( '<span class="cat-links">' . __( 'Posted in %1$s', 'sydney' ) . '</span>', $categories_list );
	}
}

  1. Find the following line:

<span class="author vcard">

then change it to


<span class="author post-author">

  1. Fund the following line:

<span class="posted-on">

then change it to


<span class="posted-on post-date updated">

  1. Install and activate your child theme

Regards,
Kharis

Thank you Kharis. I appreciate that detailed reply… I will give this a try and reply back ASAP!

Scott

Hi Kharis,
I made the changes to the file sydney-child/content-single.php (that I copied from the parent theme to the child):
<?php the_title( '<h1 class="title-post entry-title">', '</h1>' ); ?>

As well I copied the code you provided into the functions.php in the child and changed the two entries you listed:
<span class="author post-author">
<span class="posted-on post-date updated">

I actually installed the child theme and had it activated as I made the changes but I deactivated, changed themes and than changed back and activated the child after I made the changes… oops

Unfortunately I don’t think the changes I made worked but they do seem to be where they belong when checking on them with the edit tool. Would you be so kind as to check?

These two url’s show as failed in my google search console for the following:
Missing: author
Missing: entry-title
Missing: updated

http://www.apvelectronics.com/contact/
http://www.apvelectronics.com/about/

The test tool doesn’t show it fixed, only shows: entry-content

https://developers.google.com/structured-data/testing-tool/

Thanks,

Scott

Dear Scott,

Thank you for updating me.

Apologies I missed something. The following files must be edited as well, as they contain <h2 class="title-post">.

  • content-page.php
  • content-search.php
  • content.php

Let me know how it goes.

Regards,
Kharis

Hi Kharis,
Excuse my ignorance it has been years since I’ve done development. In my day it was notepad and hand writing sites with plain HTML. This is new! :slight_smile:

If I follow you I should append:
entry-title As such:
<h2 class="title-post <strong>entry-title</strong>">

To the following PHP’s

Do I copy these?:

  • content-page.php
  • content-search.php
  • content.php

To the child and edit them or edit the ones in the parent?

Thank you for dedicating your time.

Scott

I meant to bold my change… I guess that does not work in the code tag… sorry.

Hi,
I copied these to the child:

  • content-page.php
  • content-search.php
  • content.php
    and added the entry entry-title like this:
    <h2 class="title-post entry-title">

This shows up in the google structured data tool now"

hatom hentry [hentry]: entry-title: ABOUT entry-content: " APV Electronics - " We Fix The Things That Count..! " Established in 1983 - APV Electronics is the local technology leader in computers and networking. Shop Repair Services: Jeff, APV's lead...

So the entry-title is there now. Should these two show there as well?:
Missing: author
Missing: updated

They were on the failed list in the google search console.

Thanks for helping…!

Scott

This is what I have but it does not seem to be functioning. Did I miss anything for author or updated? Thanks!

<?php
/**
 * Sydney child functions
 *
 */

/**
 * Enqueues the parent stylesheet. Do not remove this function.
 *
 */
add_action( 'wp_enqueue_scripts', 'sydney_child_enqueue' );
function sydney_child_enqueue() {
    
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

}

/* ADD YOUR CUSTOM FUNCTIONS BELOW */

/**
 * Prints HTML with meta information for the current post-date/time and author.
 */
function sydney_posted_on() {
	$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
		$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%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() )
	);

	$posted_on = sprintf(
		_x( 'Posted on %s', 'post date', 'sydney' ),
		'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
	);

	$byline = sprintf(
		_x( '%s', 'post author', 'sydney' ),
		'<span class="author post-author"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
	);

	echo '<span class="posted-on post-date updated">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>';

	if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
		echo '<span class="comments-link">';
		comments_popup_link( __( 'Leave a comment', 'sydney' ), __( '1 Comment', 'sydney' ), __( '% Comments', 'sydney' ) );
		echo '</span>';
	}

	$categories_list = get_the_category_list( __( ', ', 'sydney' ) );
	if ( $categories_list && sydney_categorized_blog() ) {
		printf( '<span class="cat-links">' . __( 'Posted in %1$s', 'sydney' ) . '</span>', $categories_list );
	}
}

I tested your pages here. They seem to be fine now.

Pages doesn’t have author and post date by default. It is designed as the way it is to distinguish with the posts.

But if you wish your pages to have them. Try to copy the content-page.php file to your child theme. Then go to the following lines:


<header class="entry-header">
  <?php the_title( '<h1 class="title-post">', '</h1>' ); ?>
</header><!-- .entry-header -->

Change the code above to


<header class="entry-header">
	<?php the_title( '<h1 class="title-post">', '</h1>' ); ?>
	<div class="meta-post">
		<?php sydney_posted_on(); ?>
	</div><!-- .entry-meta -->
</header><!-- .entry-header -->

Regards,
Kharis

I’m going to try this and get back ASAP. Thanks.

Aside:
I just noticed that when putting the child-theme for this fix it removed all the slider customization’s from the main index/front page…It went back to the original “Sydney Text”. Only the slider Text and Images changed, the Header / Title did not. Just a warning to others that this happened. Maybe there was a file I should have moved to the child from the parent? Short term I recreated the entries. If I should have moved a file and anyone knows which one let me know please. I would like my install to be "correct"
Thanks!

Hi Kharis,

Thank you. I put in your suggested changes and I think from what i’m seeing below it should be OK now (Title is there and Published is there). The author is not there but I don’t see why google is barking about that in the search console for a regular page. Do you think I need to add it or is it safe to let it go? I haven’t created or tested posts yet. I’ll do that tonight. Let me know what you think about adding the author on a regular “page”…

Thanks again!

Structured Data Test Tool

hatom hentry [hentry]: entry-title: ABOUT entry-content: " APV Electronics - " We Fix The Things That Count..! " Established in 1983 - APV Electronics is the local technology leader in computers and networking. Shop Repair Services: Jeff, APV's lead... updated: March 17, 2016 published: March 17, 2016 bookmark: http://www.apvelectronics.com/about/

Hi Kharis,

Sorry to be a pest. Would you be able to show me how to add the “author” attribute to the page? It turns out I need it.

It shows in the new google search console as a reason they won’t display rich snippets automatically on the page:

This property (author) is missing in the html markup. This can prevent the rich snippet from appearing.

They follow up with a link to schema.org. I have tried to figure it out but have failed. I appreciate your help so far and see your hands are full in this forum.

Thank you,

Scott

Dear Scott,

I would like to apologize in advance for the delayed respond.

> It went back to the original “Sydney Text”. Only the slider Text and Images changed, the Header / Title did not.

Maybe the customizer setup you have done previously won’t be synced. Please follow these steps. Search for sydney and replace it with sydney-child (your child theme’s folder name).

> Do you think I need to add it or is it safe to let it go?

I think it is fine to let it go. If you want to do so, my previous reply is the way to go.

Regards,
Kharis

Hi,
I had just manually replicated the changes I had originally made over again and they are fine you are right they may not be replicating automatically. I will try your method. Thanks so much. You have been awesome. I will mark this resolved. Hopefully this thread will help others. Have a great weekend…
Scott

Hi kharis,
I have followed your instructions, copy the following files from Sydney parent theme folder to sydney-child theme folder and made different changes you outlined.
Here are the results:
content-page.php
https://goo.gl/mByZ3r

content-search.php
https://goo.gl/09REwm

content-single.php
https://goo.gl/m29HI3

content.php
https://goo.gl/r9K9vN

functions.php
https://goo.gl/UFzlfl

I want you to analyse these files and tell me if they contain errors or not, and if so, what are they?
I have not yet activated sydney child theme.
I’m looking forward to taking into account your wise advices before I go forward.

Further information:
Google search structured data errors
Today
https://goo.gl/wqR2bf
https://goo.gl/uGY7Ux

2016-04-08
https://goo.gl/kwHboh
https://goo.gl/TZvYNz

My structured data errors are all located on my blog page:
http://www.blogdalliedkien.com/blog/

For anyone might be curious, I posted my reply here.

This is all new to me. Question.

If I do this using the Child Theme will I loose anything that I’ve done all ready to the existing template?

Thanks

Anything you’ve done will remain there.

I’m running Sydney Pro, do I need a Sydney Pro Child Theme?

Thanks