Merge pull request #13340 from woocommerce/fix-13331

JSON-LD
This commit is contained in:
Claudio Sanches 2017-02-24 15:10:23 -03:00 committed by GitHub
commit 9cb6549ea7
1 changed files with 12 additions and 8 deletions

View File

@ -248,14 +248,18 @@ class WC_Structured_Data {
$markup['@id'] = get_comment_link( $comment->comment_ID );
$markup['datePublished'] = get_comment_date( 'c', $comment->comment_ID );
$markup['description'] = get_comment_text( $comment->comment_ID );
$markup['itemReviewed'] = array(
'@type' => 'Product',
'name' => get_the_title( $comment->post_ID ),
);
$markup['reviewRating'] = array(
'@type' => 'rating',
'ratingValue' => get_comment_meta( $comment->comment_ID, 'rating', true ),
);
if ( $rating = get_comment_meta( $comment->comment_ID, 'rating', true ) ) {
$markup['reviewRating'] = array(
'@type' => 'rating',
'ratingValue' => $rating,
);
// Skip replies unless they have a rating.
} elseif ( $comment->comment_parent ) {
return;
}
$markup['author'] = array(
'@type' => 'Person',
'name' => get_comment_author( $comment->comment_ID ),