Skip to content

Commit 93a47d8

Browse files
authored
Merge pull request #159 from brainstormforce/review-schema-image-fix
Review schema image fix
2 parents 2f3638d + 690dd79 commit 93a47d8

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Review, Event, People, Product, Recipe, Software Application, Video, Articles et
8282

8383
### 1.6.11.1 ###
8484
- Improvement: Updated plugin metadata tags to improve search optimization.
85+
- Improvement: Added Product Image field in Review Schema.
8586

8687
### 1.6.11 ###
8788
- Fixed: Improved code quality syntax and security checks for better coding standards and practices.

functions.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ function display_rich_snippet( $content ) {
9191
$item_event_local = get_post_meta( $post->ID, '_bsf_item_event_local', true );
9292
$item_event_region = get_post_meta( $post->ID, '_bsf_item_event_region', true );
9393
$item_event_postal_code = get_post_meta( $post->ID, '_bsf_item_event_postal_code', true );
94+
$item_pro_image = get_post_meta( $post->ID, '_bsf_item_pro_image', true );
9495
$item_pro_name = get_post_meta( $post->ID, '_bsf_item_pro_name', true );
9596
$item_pro_price = get_post_meta( $post->ID, '_bsf_item_pro_price', true );
9697
$item_pro_cur = get_post_meta( $post->ID, '_bsf_item_pro_cur', true );
@@ -112,6 +113,10 @@ function display_rich_snippet( $content ) {
112113
$review .= '<div class="snippet-image"><img width="180" src="' . esc_url( $item_recp_photo ) . '" alt="recipe image"/></div>';
113114
$review .= '<div class="aio-info">';
114115
}
116+
if ( 'item_product' == $item_review_type ) {
117+
$review .= '<div class="snippet-image"><img width="180" src="' . esc_url( $item_pro_image ) . '" alt="recipe image"/></div>';
118+
$review .= '<div class="aio-info">';
119+
}
115120
if ( 'item_video' == $item_review_type ) {
116121
$review .= '<div class="snippet-image"><img width="180" src="' . esc_url( $item_video_thumb ) . '" alt="Video Image"/></div>';
117122
$review .= '<div class="aio-info">';
@@ -213,6 +218,7 @@ function display_rich_snippet( $content ) {
213218
}
214219
$review .= " <div class='snippet-data'><span itemprop='name'>" . esc_attr( stripslashes( $item_pro_name ) ) . '</span></div>';
215220
}
221+
216222
if ( '' != trim( $item_pro_price ) ) {
217223

218224
if ( '' != $item_product['product_price'] ) {
@@ -229,7 +235,12 @@ function display_rich_snippet( $content ) {
229235
}
230236
$review .= '</div>';
231237
}
232-
$review .= '</span>';
238+
239+
if ( '' != trim( $item_pro_image ) ) {
240+
$review .= '<meta itemprop="image" content="' . esc_attr( $item_pro_image ) . '">';
241+
}
242+
243+
$review .= '</span></div>';
233244
}
234245
if ( 'item_recipe' == $item_review_type ) {
235246
$item_recipe = get_option( 'bsf_recipe' );

meta-boxes.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,13 @@ function bsf_metaboxes( array $meta_boxes ) {
202202
'class' => 'product_item_type',
203203
'type' => 'text',
204204
),
205+
array(
206+
'name' => __( 'Product Image', 'all-in-one-schemaorg-rich-snippets' ),
207+
'desc' => __( 'Upload the product image or select from library. Medium size is recommended (300px X 300px)', 'all-in-one-schemaorg-rich-snippets' ),
208+
'id' => $prefix . 'item_pro_image',
209+
'class' => 'product_item_type',
210+
'type' => 'file',
211+
),
205212
array(
206213
'name' => __( 'Product Price', 'all-in-one-schemaorg-rich-snippets' ),
207214
'desc' => __( 'Enter the product Price.', 'all-in-one-schemaorg-rich-snippets' ),

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Review, Event, People, Product, Recipe, Software Application, Video, Articles et
8282

8383
= 1.6.11.1 =
8484
- Improvement: Updated plugin metadata tags to improve search optimization.
85+
- Improvement: Added Product Image field in Review Schema.
8586

8687
= 1.6.11 =
8788
- Fixed: Improved code quality syntax and security checks for better coding standards and practices.

0 commit comments

Comments
 (0)