Schema & Structured Data for WP & AMP - Version 1.9.52

Version Description

(26 Oct 2020) =

  • Fixed: When city names added manually by separating with comma, in store schema, in output of schema markup all city name are showing as one value in areaServed property #1217
  • Fixed: Item list schema is getting generated on the product category pages even though the Archive option is unchecked. we need to connect it to that option. #1177
  • Fixed: When we click on avvo icon it redirecting to homepage (Reviews for Schema). #1216
  • Fixed: Fatal error: Uncaught Error: Call to undefined function mptt_get_event_data () #1222
  • Fixed: User ID Missing issue when fetching the "AVVO" reviews. #1187
  • Added: gtin12 property in product schema #1054
Download this release

Release Info

Developer magazine3
Plugin Icon 128x128 Schema & Structured Data for WP & AMP
Version 1.9.52
Comparing to
See all releases

Code changes from version 1.9.51 to 1.9.52

admin_section/common-function.php CHANGED
@@ -3171,8 +3171,8 @@ function saswp_current_user_allowed(){
3171
 
3172
  $hasrole = array_intersect( $currentuserrole, $saswp_roles );
3173
 
3174
- if( !empty($hasrole)){
3175
- return $hasrole[0];
3176
  }
3177
 
3178
  }
@@ -3908,4 +3908,28 @@ function saswp_get_image_size_url( $image_id, $size = 'full', $image_sizes = arr
3908
  }
3909
 
3910
  return $image_url;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3911
  }
3171
 
3172
  $hasrole = array_intersect( $currentuserrole, $saswp_roles );
3173
 
3174
+ if( !empty($hasrole)){
3175
+ return reset($hasrole);
3176
  }
3177
 
3178
  }
3908
  }
3909
 
3910
  return $image_url;
3911
+ }
3912
+
3913
+ function saswp_area_served_expload ($data) {
3914
+
3915
+ $response = array();
3916
+
3917
+ if($data){
3918
+
3919
+ $area_served = explode(',', $data);
3920
+
3921
+ if($area_served){
3922
+
3923
+ foreach ($area_served as $value) {
3924
+ $response[] = array(
3925
+ '@type' => 'Place',
3926
+ 'name' => $value
3927
+ );
3928
+ }
3929
+
3930
+ }
3931
+
3932
+ }
3933
+
3934
+ return $response;
3935
  }
core/array-list/schema-properties.php CHANGED
@@ -2444,11 +2444,17 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
2444
  'default' => saswp_remove_warnings($product_details, 'product_gtin8', 'saswp_string')
2445
  ),
2446
  array(
2447
- 'label' => 'GTIN13',
2448
- 'id' => 'saswp_product_schema_gtin13_'.$schema_id,
2449
- 'type' => 'text',
2450
- 'default' => saswp_remove_warnings($product_details, 'product_gtin13', 'saswp_string')
2451
  ),
 
 
 
 
 
 
2452
  array(
2453
  'label' => 'Seller Organization',
2454
  'id' => 'saswp_product_schema_seller_'.$schema_id,
2444
  'default' => saswp_remove_warnings($product_details, 'product_gtin8', 'saswp_string')
2445
  ),
2446
  array(
2447
+ 'label' => 'GTIN13',
2448
+ 'id' => 'saswp_product_schema_gtin13_'.$schema_id,
2449
+ 'type' => 'text',
2450
+ 'default' => saswp_remove_warnings($product_details, 'product_gtin13', 'saswp_string')
2451
  ),
2452
+ array(
2453
+ 'label' => 'GTIN12',
2454
+ 'id' => 'saswp_product_schema_gtin12_'.$schema_id,
2455
+ 'type' => 'text',
2456
+ 'default' => saswp_remove_warnings($product_details, 'product_gtin12', 'saswp_string')
2457
+ ),
2458
  array(
2459
  'label' => 'Seller Organization',
2460
  'id' => 'saswp_product_schema_seller_'.$schema_id,
modules/reviews/reviews_service.php CHANGED
@@ -634,7 +634,8 @@ class saswp_reviews_service {
634
  'saswp_review_link',
635
  'saswp_review_platform',
636
  'saswp_review_platform_icon',
637
- 'saswp_review_platform_name',
 
638
  );
639
 
640
  $service_object = new saswp_output_service();
@@ -785,8 +786,18 @@ class saswp_reviews_service {
785
  }
786
 
787
  foreach ($collection as $value){
788
-
789
  $date_str = $this->saswp_convert_datetostring($value['saswp_review_date']);
 
 
 
 
 
 
 
 
 
 
790
  $html .= '<li>';
791
  $html .= '<div class="saswp-rc">';
792
  $html .= '<div class="saswp-rc-a">';
@@ -794,7 +805,7 @@ class saswp_reviews_service {
794
  $html .= '<img loading="lazy" src="'.esc_url($value['saswp_reviewer_image']).'" width="56" height="56"/>';
795
  $html .= '</div>';
796
  $html .= '<div class="saswp-rc-nm">';
797
- $html .= '<a target="_blank" href="'.esc_url($value['saswp_review_link']).'">'.esc_attr($value['saswp_reviewer_name']).'</a>';
798
  $html .= saswp_get_rating_html_by_value($value['saswp_review_rating']);
799
  $html .= '<span class="saswp-rc-dt">'.(isset($date_str['date']) ? esc_attr($date_str['date']): '' ).'</span>';
800
  $html .= '</div>';
@@ -848,7 +859,15 @@ class saswp_reviews_service {
848
  }
849
 
850
  public function saswp_review_desing_for_slider($value){
851
-
 
 
 
 
 
 
 
 
852
  $html = '';
853
  $date_str = $this->saswp_convert_datetostring($value['saswp_review_date']);
854
 
@@ -873,7 +892,7 @@ class saswp_reviews_service {
873
  $html .= '<div class="saswp-rc-a">';
874
  $html .= '<img loading="lazy" src="'.esc_url($value['saswp_reviewer_image']).'"/>';
875
  $html .= '<div class="saswp-rc-nm">';
876
- $html .= '<a target="_blank" href="'.esc_url($value['saswp_review_link']).'">'. esc_attr($value['saswp_reviewer_name']).'</a>';
877
  $html .= '<span class="saswp-rc-dt">'.(isset($date_str['date']) ? esc_attr($date_str['date']): '' ).'</span>';
878
  $html .= '</div>';
879
  $html .= '</div>';
634
  'saswp_review_link',
635
  'saswp_review_platform',
636
  'saswp_review_platform_icon',
637
+ 'saswp_review_platform_name',
638
+ 'saswp_review_location_id'
639
  );
640
 
641
  $service_object = new saswp_output_service();
786
  }
787
 
788
  foreach ($collection as $value){
789
+
790
  $date_str = $this->saswp_convert_datetostring($value['saswp_review_date']);
791
+
792
+ $review_link = $value['saswp_review_link'];
793
+
794
+ if($value['saswp_review_platform_name'] == 'Avvo' && $review_link == ''){
795
+
796
+ $review_link = $value['saswp_review_location_id'].'#client_reviews';
797
+
798
+ }
799
+
800
+
801
  $html .= '<li>';
802
  $html .= '<div class="saswp-rc">';
803
  $html .= '<div class="saswp-rc-a">';
805
  $html .= '<img loading="lazy" src="'.esc_url($value['saswp_reviewer_image']).'" width="56" height="56"/>';
806
  $html .= '</div>';
807
  $html .= '<div class="saswp-rc-nm">';
808
+ $html .= '<a target="_blank" href="'.esc_url($review_link).'">'.esc_attr($value['saswp_reviewer_name']).'</a>';
809
  $html .= saswp_get_rating_html_by_value($value['saswp_review_rating']);
810
  $html .= '<span class="saswp-rc-dt">'.(isset($date_str['date']) ? esc_attr($date_str['date']): '' ).'</span>';
811
  $html .= '</div>';
859
  }
860
 
861
  public function saswp_review_desing_for_slider($value){
862
+
863
+ $review_link = $value['saswp_review_link'];
864
+
865
+ if($value['saswp_review_platform_name'] == 'Avvo' && $review_link == ''){
866
+
867
+ $review_link = $value['saswp_review_location_id'].'#client_reviews';
868
+
869
+ }
870
+
871
  $html = '';
872
  $date_str = $this->saswp_convert_datetostring($value['saswp_review_date']);
873
 
892
  $html .= '<div class="saswp-rc-a">';
893
  $html .= '<img loading="lazy" src="'.esc_url($value['saswp_reviewer_image']).'"/>';
894
  $html .= '<div class="saswp-rc-nm">';
895
+ $html .= '<a target="_blank" href="'.esc_url($review_link).'">'. esc_attr($value['saswp_reviewer_name']).'</a>';
896
  $html .= '<span class="saswp-rc-dt">'.(isset($date_str['date']) ? esc_attr($date_str['date']): '' ).'</span>';
897
  $html .= '</div>';
898
  $html .= '</div>';
output/markup.php CHANGED
@@ -874,6 +874,9 @@ function saswp_product_schema_markup($schema_id, $schema_post_id, $all_post_meta
874
  if(isset($all_post_meta['saswp_product_schema_gtin13_'.$schema_id])){
875
  $input1['gtin13'] = esc_attr($all_post_meta['saswp_product_schema_gtin13_'.$schema_id][0]);
876
  }
 
 
 
877
  if(isset($all_post_meta['saswp_product_schema_mpn_'.$schema_id])){
878
  $input1['mpn'] = esc_attr($all_post_meta['saswp_product_schema_mpn_'.$schema_id][0]);
879
  }
@@ -1174,12 +1177,8 @@ function saswp_local_business_schema_markup($schema_id, $schema_post_id, $all_po
1174
  $input1['servesCuisine'] = esc_attr($all_post_meta['local_serves_cuisine_'.$schema_id][0]);
1175
  }
1176
 
1177
- if(isset($all_post_meta['local_area_served_'.$schema_id][0])){
1178
-
1179
- $area_served = explode(',', $all_post_meta['local_area_served_'.$schema_id][0]);
1180
-
1181
- $input1['areaServed'] = $area_served;
1182
-
1183
  }
1184
 
1185
  //social fields starts here
874
  if(isset($all_post_meta['saswp_product_schema_gtin13_'.$schema_id])){
875
  $input1['gtin13'] = esc_attr($all_post_meta['saswp_product_schema_gtin13_'.$schema_id][0]);
876
  }
877
+ if(isset($all_post_meta['saswp_product_schema_gtin12_'.$schema_id])){
878
+ $input1['gtin12'] = esc_attr($all_post_meta['saswp_product_schema_gtin12_'.$schema_id][0]);
879
+ }
880
  if(isset($all_post_meta['saswp_product_schema_mpn_'.$schema_id])){
881
  $input1['mpn'] = esc_attr($all_post_meta['saswp_product_schema_mpn_'.$schema_id][0]);
882
  }
1177
  $input1['servesCuisine'] = esc_attr($all_post_meta['local_serves_cuisine_'.$schema_id][0]);
1178
  }
1179
 
1180
+ if(isset($all_post_meta['local_area_served_'.$schema_id][0])){
1181
+ $input1['areaServed'] = saswp_area_served_expload( $all_post_meta['local_area_served_'.$schema_id][0] );
 
 
 
 
1182
  }
1183
 
1184
  //social fields starts here
output/output.php CHANGED
@@ -470,7 +470,7 @@ function saswp_schema_output() {
470
  $input1 = array_merge($input1, $woo_markp);
471
  }
472
 
473
- unset($input1['brand'], $input1['mpn'], $input1['sku'],$input1['gtin8'], $input1['gtin13']);
474
 
475
  $input1 = saswp_append_fetched_reviews($input1, $schema_post_id);
476
 
@@ -1133,7 +1133,7 @@ function saswp_schema_output() {
1133
  $input1 = array_merge($input1, $woo_markp);
1134
  }
1135
 
1136
- unset($input1['brand'], $input1['mpn'], $input1['sku'],$input1['gtin8'], $input1['gtin13']);
1137
 
1138
  if(!empty($publisher)){
1139
  $input1 = array_merge($input1, $publisher);
@@ -1178,7 +1178,7 @@ function saswp_schema_output() {
1178
  $input1 = array_merge($input1, $woo_markp);
1179
  }
1180
 
1181
- unset($input1['brand'], $input1['mpn'], $input1['sku'],$input1['gtin8'], $input1['gtin13']);
1182
 
1183
  if(!empty($publisher)){
1184
  $input1 = array_merge($input1, $publisher);
@@ -2173,7 +2173,7 @@ function saswp_woocommerce_category_schema(){
2173
 
2174
  global $query_string, $sd_data;
2175
 
2176
- if ( function_exists('is_product_category') && is_product_category()) {
2177
 
2178
  $list_item = array();
2179
  $term = get_queried_object();
@@ -2236,10 +2236,12 @@ function saswp_woocommerce_category_schema(){
2236
 
2237
  function saswp_woocommerce_shop_page(){
2238
 
 
 
2239
  $collection = array();
2240
  $itemlist_arr = array();
2241
 
2242
- if(function_exists('is_shop') && function_exists('woocommerce_get_loop_display_mode') && is_shop()){
2243
 
2244
  $display_type = woocommerce_get_loop_display_mode();
2245
  $parent_id = is_product_category() ? get_queried_object_id() : 0;
470
  $input1 = array_merge($input1, $woo_markp);
471
  }
472
 
473
+ unset($input1['brand'], $input1['mpn'], $input1['sku'],$input1['gtin8'], $input1['gtin13'], $input1['gtin12']);
474
 
475
  $input1 = saswp_append_fetched_reviews($input1, $schema_post_id);
476
 
1133
  $input1 = array_merge($input1, $woo_markp);
1134
  }
1135
 
1136
+ unset($input1['brand'], $input1['mpn'], $input1['sku'],$input1['gtin8'], $input1['gtin13'], $input1['gtin12']);
1137
 
1138
  if(!empty($publisher)){
1139
  $input1 = array_merge($input1, $publisher);
1178
  $input1 = array_merge($input1, $woo_markp);
1179
  }
1180
 
1181
+ unset($input1['brand'], $input1['mpn'], $input1['sku'],$input1['gtin8'], $input1['gtin13'], $input1['gtin12']);
1182
 
1183
  if(!empty($publisher)){
1184
  $input1 = array_merge($input1, $publisher);
2173
 
2174
  global $query_string, $sd_data;
2175
 
2176
+ if ( function_exists('is_product_category') && is_product_category() && ( isset($sd_data['saswp_archive_schema']) && $sd_data['saswp_archive_schema'] == 1 ) ) {
2177
 
2178
  $list_item = array();
2179
  $term = get_queried_object();
2236
 
2237
  function saswp_woocommerce_shop_page(){
2238
 
2239
+ global $sd_data;
2240
+
2241
  $collection = array();
2242
  $itemlist_arr = array();
2243
 
2244
+ if(function_exists('is_shop') && function_exists('woocommerce_get_loop_display_mode') && is_shop() && (isset( $sd_data['saswp_archive_schema']) && $sd_data['saswp_archive_schema'] == 1 ) ){
2245
 
2246
  $display_type = woocommerce_get_loop_display_mode();
2247
  $parent_id = is_product_category() ? get_queried_object_id() : 0;
output/service.php CHANGED
@@ -1221,7 +1221,7 @@ Class saswp_output_service{
1221
  $input1['openingHours'] = $custom_fields['saswp_dayofweek'];
1222
  }
1223
  if(isset($custom_fields['local_area_served'])){
1224
- $input1['areaServed'] = $custom_fields['local_area_served'];
1225
  }
1226
  if(isset($custom_fields['local_price_range'])){
1227
  $input1['priceRange'] = $custom_fields['local_price_range'];
@@ -1973,6 +1973,9 @@ Class saswp_output_service{
1973
  if(isset($custom_fields['saswp_product_schema_gtin13'])){
1974
  $input1['gtin13'] = $custom_fields['saswp_product_schema_gtin13'];
1975
  }
 
 
 
1976
  if(isset($custom_fields['saswp_product_additional_type'])){
1977
  $input1['additionalType'] = $custom_fields['saswp_product_additional_type'];
1978
  }
@@ -2208,7 +2211,7 @@ Class saswp_output_service{
2208
  $input1['description'] = wp_strip_all_tags(strip_shortcodes( $custom_fields['saswp_service_schema_description'] ));
2209
  }
2210
  if(isset($custom_fields['saswp_service_schema_area_served'])){
2211
- $input1['areaServed'] = $custom_fields['saswp_service_schema_area_served'];
2212
  }
2213
  if(isset($custom_fields['saswp_service_schema_service_offer'])){
2214
  $input1['hasOfferCatalog'] = $custom_fields['saswp_service_schema_service_offer'];
@@ -3372,7 +3375,12 @@ Class saswp_output_service{
3372
 
3373
  $product_details['product_gtin13'] = $attribute['options'][0];
3374
 
3375
- }
 
 
 
 
 
3376
  if(strtolower($attribute['name']) == 'brand'){
3377
 
3378
  $product_details['product_brand'] = $attribute['options'][0];
@@ -4089,6 +4097,9 @@ Class saswp_output_service{
4089
  if(isset($product_details['product_gtin13']) && $product_details['product_gtin13'] !=''){
4090
  $input1['gtin13'] = esc_attr($product_details['product_gtin13']);
4091
  }
 
 
 
4092
  if(isset($product_details['product_mpn']) && $product_details['product_mpn'] !=''){
4093
  $input1['mpn'] = esc_attr($product_details['product_mpn']);
4094
  }
1221
  $input1['openingHours'] = $custom_fields['saswp_dayofweek'];
1222
  }
1223
  if(isset($custom_fields['local_area_served'])){
1224
+ $input1['areaServed'] = saswp_area_served_expload($custom_fields['local_area_served']);
1225
  }
1226
  if(isset($custom_fields['local_price_range'])){
1227
  $input1['priceRange'] = $custom_fields['local_price_range'];
1973
  if(isset($custom_fields['saswp_product_schema_gtin13'])){
1974
  $input1['gtin13'] = $custom_fields['saswp_product_schema_gtin13'];
1975
  }
1976
+ if(isset($custom_fields['saswp_product_schema_gtin12'])){
1977
+ $input1['gtin12'] = $custom_fields['saswp_product_schema_gtin12'];
1978
+ }
1979
  if(isset($custom_fields['saswp_product_additional_type'])){
1980
  $input1['additionalType'] = $custom_fields['saswp_product_additional_type'];
1981
  }
2211
  $input1['description'] = wp_strip_all_tags(strip_shortcodes( $custom_fields['saswp_service_schema_description'] ));
2212
  }
2213
  if(isset($custom_fields['saswp_service_schema_area_served'])){
2214
+ $input1['areaServed'] = saswp_area_served_expload($custom_fields['saswp_service_schema_area_served']);
2215
  }
2216
  if(isset($custom_fields['saswp_service_schema_service_offer'])){
2217
  $input1['hasOfferCatalog'] = $custom_fields['saswp_service_schema_service_offer'];
3375
 
3376
  $product_details['product_gtin13'] = $attribute['options'][0];
3377
 
3378
+ }
3379
+ if(strtolower($attribute['name']) == 'gtin12'){
3380
+
3381
+ $product_details['product_gtin12'] = $attribute['options'][0];
3382
+
3383
+ }
3384
  if(strtolower($attribute['name']) == 'brand'){
3385
 
3386
  $product_details['product_brand'] = $attribute['options'][0];
4097
  if(isset($product_details['product_gtin13']) && $product_details['product_gtin13'] !=''){
4098
  $input1['gtin13'] = esc_attr($product_details['product_gtin13']);
4099
  }
4100
+ if(isset($product_details['product_gtin12']) && $product_details['product_gtin12'] !=''){
4101
+ $input1['gtin12'] = esc_attr($product_details['product_gtin12']);
4102
+ }
4103
  if(isset($product_details['product_mpn']) && $product_details['product_mpn'] !=''){
4104
  $input1['mpn'] = esc_attr($product_details['product_mpn']);
4105
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: magazine3
3
  Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
4
  Requires at least: 3.0
5
  Tested up to: 5.5
6
- Stable tag: 1.9.51
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -120,6 +120,16 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)
120
 
121
  == Changelog ==
122
 
 
 
 
 
 
 
 
 
 
 
123
  = 1.9.51 (15 Oct 2020) =
124
 
125
  * Added: Option to show VideoObject json-LD, Only if video is available on the post #1197
3
  Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
4
  Requires at least: 3.0
5
  Tested up to: 5.5
6
+ Stable tag: 1.9.52
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
120
 
121
  == Changelog ==
122
 
123
+ = 1.9.52 (26 Oct 2020) =
124
+
125
+ * Fixed: When city names added manually by separating with comma, in store schema, in output of schema markup all city name are showing as one value in areaServed property #1217
126
+ * Fixed: Item list schema is getting generated on the product category pages even though the Archive option is unchecked. we need to connect it to that option. #1177
127
+ * Fixed: When we click on avvo icon it redirecting to homepage (Reviews for Schema). #1216
128
+ * Fixed: Fatal error: Uncaught Error: Call to undefined function mptt_get_event_data () #1222
129
+ * Fixed: User ID Missing issue when fetching the "AVVO" reviews. #1187
130
+ * Added: gtin12 property in product schema #1054
131
+
132
+
133
  = 1.9.51 (15 Oct 2020) =
134
 
135
  * Added: Option to show VideoObject json-LD, Only if video is available on the post #1197
structured-data-for-wp.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Schema & Structured Data for WP & AMP
4
  Description: Schema & Structured Data adds Google Rich Snippets markup according to Schema.org guidelines to structure your site for SEO. (AMP Compatible)
5
- Version: 1.9.51
6
  Text Domain: schema-and-structured-data-for-wp
7
  Domain Path: /languages
8
  Author: Magazine3
@@ -13,7 +13,7 @@ License: GPL2
13
  // Exit if accessed directly.
14
  if ( ! defined( 'ABSPATH' ) ) exit;
15
 
16
- define('SASWP_VERSION', '1.9.51');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
2
  /*
3
  Plugin Name: Schema & Structured Data for WP & AMP
4
  Description: Schema & Structured Data adds Google Rich Snippets markup according to Schema.org guidelines to structure your site for SEO. (AMP Compatible)
5
+ Version: 1.9.52
6
  Text Domain: schema-and-structured-data-for-wp
7
  Domain Path: /languages
8
  Author: Magazine3
13
  // Exit if accessed directly.
14
  if ( ! defined( 'ABSPATH' ) ) exit;
15
 
16
+ define('SASWP_VERSION', '1.9.52');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));