Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added image field in the product review schema. #129

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ Review, Event, People, Product, Recipe, Software Application, Video, Articles et

## Changelog ##

### 1.6.6 ###
- Fixed - Added image field in the product review schema.

### 1.6.5 ###
- Fixed - Code updated according to coding standard.

Expand Down
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,10 @@
"post-update-cmd": "vendor/bin/cghooks update",
"format": "phpcbf --standard=phpcs.xml.dist",
"lint": "phpcs --standard=phpcs.xml.dist"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
11 changes: 10 additions & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ function display_rich_snippet( $content ) {
$item_pro_price = get_post_meta( $post->ID, '_bsf_item_pro_price', true );
$item_pro_cur = get_post_meta( $post->ID, '_bsf_item_pro_cur', true );
$item_pro_status = get_post_meta( $post->ID, '_bsf_item_pro_status', true );
$item_pro_photo = get_post_meta( $post->ID, '_bsf_item_pro_product_image', true );
$item_recp_name = get_post_meta( $post->ID, '_bsf_item_recipes_name', true );
$item_recp_photo = get_post_meta( $post->ID, '_bsf_item_recipes_photo', true );
$item_soft_name = get_post_meta( $post->ID, '_bsf_item_soft_name', true );
Expand All @@ -116,6 +117,11 @@ function display_rich_snippet( $content ) {
$review .= '<div class="snippet-image"><img width="180" src="' . esc_url( $item_video_thumb ) . '" alt="Video Image"/></div>';
$review .= '<div class="aio-info">';
}
if ( 'item_product' == $item_review_type ) {
$review .= '<div class="snippet-image"><img width="180" src="' . esc_url( $item_pro_photo ) . '" alt="Product Image"/></div>';
$review .= '<div class="aio-info">';

}
if ( '' != trim( $reviewer ) ) {
if ( '' != $args_review['item_reviewer'] ) {
$review .= '<span itemprop="author" itemscope itemtype="https://schema.org/Person">';
Expand Down Expand Up @@ -210,6 +216,9 @@ function display_rich_snippet( $content ) {
$review .= "<div class='snippet-label'>" . esc_attr( stripslashes( $item_product['product_name'] ) ) . '</div>';
}
$review .= " <div class='snippet-data'><span itemprop='name'>" . esc_attr( stripslashes( $item_pro_name ) ) . '</span></div>';
if ( '' != trim( $item_pro_photo ) ) {
$review .= '<meta itemprop="image" content="' . esc_attr( $item_pro_photo ) . '">';
}
}
if ( '' != trim( $item_pro_price ) ) {

Expand Down Expand Up @@ -416,7 +425,7 @@ function display_rich_snippet( $content ) {
$org_latitude = get_post_meta( $post->ID, '_bsf_organization_latitude', true );
$org_longitude = get_post_meta( $post->ID, '_bsf_organization_longitude', true );
if ( '' != trim( $org_name ) ) {
$organization .= 'Organization Name : <span property="v:name">' . esc_attr( $org_nam ) . '</span></div>';
$organization .= 'Organization Name : <span property="v:name">' . esc_attr( $org_name ) . '</span></div>';
}
if ( '' != trim( $org_url ) ) {
$organization .= 'Website : <a href="' . esc_url( $org_url ) . '" rel="v:url">' . esc_attr( $org_url ) . '</a></div>';
Expand Down
7 changes: 7 additions & 0 deletions meta-boxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@ function bsf_metaboxes( array $meta_boxes ) {
'class' => 'product_item_type',
'type' => 'text',
),
array(
'name' => __( 'Product Image', 'all-in-one-schemaorg-rich-snippets' ),
'desc' => __( 'Upload the product image or select from library. Medium size is recommended (300px X 300px)', 'all-in-one-schemaorg-rich-snippets' ),
'id' => $prefix . 'item_pro_product_image',
'class' => 'product_item_type',
'type' => 'file',
),
array(
'name' => __( 'Product Price', 'all-in-one-schemaorg-rich-snippets' ),
'desc' => __( 'Enter the product Price.', 'all-in-one-schemaorg-rich-snippets' ),
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ Review, Event, People, Product, Recipe, Software Application, Video, Articles et

== Changelog ==

= 1.6.6 =
- Fixed - Added image field in the product review schema.

= 1.6.5 =
- Fixed - Code updated according to coding standard.

Expand Down