Google rich snippet – Warning

Community Forums Forums Design Tips and Tricks Google rich snippet – Warning

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  cehwitham 1 year, 5 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10917

    mariafernandez
    Participant
    Post count: 18

    In order to get rid of the “Warning: Missing required field “updated”.” in the Google Webmaster Structured Data Testing Tool, I’ve added the code below to my functions.php file (Balance theme). Unfortunately, it has also added a second ‘By Maria Fernandez” line to all my posts, as well as the date and  “Updated: <date>”. These new lines make my blog unsightly.

    Is there a way I can modify the code below so that I can remove the Warning without adding the date, “By <author>” and “Updated” lines?

    My blog is: http://www.spanish-bites.com/

    —–

    remove_action( ‘genesis_before_post_content’, ‘genesis_post_info’ );

    add_action( ‘genesis_before_post_content’, ‘child_post_info’ );

    function child_post_info() {

    if ( is_page() )

    return; // don’t do post-info on pages ?>

    <div class=”post-info”>

    <span class=”date published time”>

    <time class=”entry-date” itemprop=”startDate” datetime=”<?php echo get_the_date( ‘c’ ); ?>” pubdate><?php echo get_the_date(); ?></time>

    </span> By

    <span class=”author vcard”>

    <a class=”fn n” href=”<?php echo get_the_author_url( get_the_author_meta( ‘ID’ ) ); ?>” title=”View <?php echo get_the_author(); ?>’s Profile” rel=”author me”><?php the_author_meta( ‘display_name’ ); ?></a>

    </span>

    <span class=”post-comments”>&middot; <a href=”<?php the_permalink() ?>#comments”><?php comments_number( ‘Leave a Comment’, ’1 Comment’, ‘% Comments’ ); ?></a></span>

    <?php // if the post has been modified, display the modified date

    $published = get_the_date( ‘F j, Y’ );

    $modified = the_modified_date( ‘F j, Y’, ”, ”, FALSE );

    $published_compare = get_the_date( ‘Y-m-d’ );

    $modified_compare = the_modified_date( ‘Y-m-d’, ”, ”, FALSE );

    if ( $published_compare < $modified_compare ) {

    echo ‘<span class=”updated”><em>&middot; (Updated: ‘ . $modified . ‘)</em></span>’;

    } ?>

    </div>

    <?php }

    —————–

    #20945

    cehwitham
    Participant
    Post count: 396

    Hi Maria,

    I can’t see the dates outputting on your site.

    Could you just add the updated class to the published date? Would that satisfy Google?

    Alternatively if Google / your requirements need both dates but you only want to show one of them, I think you’d be forced to hide the second one with CSS.

    Chris


    Twitter: cehwitham Web: cehwitham.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.