Receiving the following error in Rich Snippets tool for hatom-entry and can't seem to find a solution:
Error: At least one field must be set for Hcard.
Error: Missing required field "name (fn)".
I am using Sterling theme for Wordpress and currently have edited the posted by section in the single.php file to say:
<?php
if ( 'true' == $posted_by ) { ?>
<span class="metadata postinfo">
<?php _e( 'Posted by ', 'tt_theme_framework' );?> <span class="vcard author"><span class=”fn”><?php the_author_posts_link(); ?></span> <?php _e( ' on ', 'tt_theme_framework' ); ?> <span class="date updated"><?php the_time( get_option( 'date_format' ) ); ?></span>
</span>
<?php }
but the issue still persists after testing again.
Any help would be great.
Hariprasad Vijayan answers:
Hi,
Try this
<?php
if ( 'true' == $posted_by ) { ?>
<span class="metadata postinfo hentry">
<?php _e( 'Posted by ', 'tt_theme_framework' );?> <span class="vcard author"><span class=”fn” itemprop="author"><?php the_author_posts_link(); ?></span> <?php _e( ' on ', 'tt_theme_framework' ); ?> <span class="date updated"><?php the_time( get_option( 'date_format' ) ); ?></span>
</span>
<?php }
berkoz912 comments:
I deleted my original and replaced it with your but it didnt work so I reverted back
Hariprasad Vijayan comments:
Okay.
Add new class "hentry" to <article class="preview blog-main-preview">
So it would be like
<article class="preview blog-main-preview hentry">
Then change class=”fn” to class="fn" in the original code that you shared.
now its rendering like this <span class="”fn”"> in your blog post.(You can see it in firebug/ inspect element.)
berkoz912 comments:
Not sure what you want me to change in your sentence, Then change class=”fn” to class="fn" in the original code that you shared
Hariprasad Vijayan comments:
Add new class "hentry" to <article class="preview blog-main-preview">
Then use following code
<?php
if ( 'true' == $posted_by ) { ?>
<span class="metadata postinfo">
<?php _e( 'Posted by ', 'tt_theme_framework' );?> <span class="vcard author"><span class="fn"><?php the_author_posts_link(); ?></span> <?php _e( ' on ', 'tt_theme_framework' ); ?> <span class="date updated"><?php the_time( get_option( 'date_format' ) ); ?></span>
</span>
<?php }
berkoz912 comments:
I changed it per your recommendations and that issue is fixed but now a set set of errors occurred:
Error: At least one field must be set for HatomEntry.
Error: Missing required field "entry-title".
Error: Missing required field "updated".
Error: Missing required hCard "author".
Hariprasad Vijayan comments:
Revert it back.
What if when you use this code alone?
<?php
if ( 'true' == $posted_by ) { ?>
<span class="metadata postinfo hentry">
<?php _e( 'Posted by ', 'tt_theme_framework' );?> <span class="vcard author"><span class="fn"><?php the_author_posts_link(); ?></span> <?php _e( ' on ', 'tt_theme_framework' ); ?> <span class="date updated"><?php the_time( get_option( 'date_format' ) ); ?></span>
</span>
<?php }
berkoz912 comments:
I took away hentry from <article class="preview blog-main-preview"> and tried your code and still receive errors. You can see the errors here: http://goo.gl/LuN9gI
Thanks for your help
Hariprasad Vijayan comments:
Try this,
<?php
if ( 'true' == $posted_by ) { ?>
<span class="metadata postinfo">
<?php _e( 'Posted by ', 'tt_theme_framework' );?> <span class="vcard author"><span class="fn"><?php the_author_posts_link(); ?></span> <?php _e( ' on ', 'tt_theme_framework' ); ?> <span class="date updated"><?php the_time( get_option( 'date_format' ) ); ?></span>
</span>
<?php }
berkoz912 comments:
Thank you Hariprasad, that seemed to have fixed it for each individual blog post. When I look the the blog overall in the testing tools, it still provides the same errors: http://goo.gl/DDyljy
Hariprasad Vijayan comments:
could you show the blog page code?
Hariprasad Vijayan comments:
<span class="fn"> is missing in blog page, please find the code and add it like single blog page.
berkoz912 comments:
Hariprasad, great job! Thanks for your help. I will be awarding you the prize :)
Navjot Singh answers:
Can you share the link where you are getting the error?
berkoz912 comments:
Im getting it on all blog posts but here an example of a post - http://goo.gl/ENCsGJ
Navjot Singh comments:
Try changing <span class="metadata postinfo"> to <span class="vcard author metadata postinfo">
berkoz912 comments:
Added it and it's currently set to that but doesnt seem to have changed in testing tool
Navjot Singh comments:
Try replacing <?php the_author_posts_link(); ?> with <?php the_author(); ?>
berkoz912 comments:
Tried that and the issue still exists. Thanks for your continuing help.
Navjot Singh comments:
Where did you change? I still see the same old code there.
berkoz912 comments:
<?php
if ( 'true' == $posted_by ) { ?>
<span class="metadata postinfo"><?php _e( 'Posted by ', 'tt_theme_framework' );?> <span class="vcard author"><span class=”fn”><?php the_author(); ?></span> <?php _e( ' on ', 'tt_theme_framework' ); ?> <span class="date updated"><?php the_time( get_option( 'date_format' ) ); ?></span>
</span>
<?php }
Navjot Singh comments:
The code has a missing close span. You are closing the span for metadata and the date. But the author one doesn't close.
Change it to
<?php
if ( 'true' == $posted_by ) { ?>
<span class="metadata postinfo"><?php _e( 'Posted by ', 'tt_theme_framework' );?> <span class="vcard author"><span class=”fn”><?php the_author(); ?></span></span> <?php _e( ' on ', 'tt_theme_framework' ); ?> <span class="date updated"><?php the_time( get_option( 'date_format' ) ); ?></span>
</span>
<?php }
berkoz912 comments:
Changed it and error is still there