Schema & Structured Data for WP & AMP - Version 1.9.76

Version Description

(25 May 2021) =

  • Added: An option for changing the FAQ (SASWP) text to H1 H2 H3 #1382
  • Added: Tutorial Links in every review platform fetch section. #1351
  • Added: bidvine.com review platform. #1341
  • Added: bark.com review platform. #1342
  • Added: Apple Podcasts review platform. #1334
  • Added: advieskeuze.nl review platform. #1419
  • Added: Add Support for WP GraphQL plugin ( https://wordpress.org/plugins/wp-graphql ) #1343
  • Fixed: Event validation issue with Event manager plugin #1422
  • Fixed: Compatibility issue: Error in FQA schema, setup by Yoast gutenberg block #1423
Download this release

Release Info

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

Code changes from version 1.9.75 to 1.9.76

admin_section/fields-generator.php CHANGED
@@ -246,7 +246,19 @@ class saswp_fields_generator {
246
  "name" => "Shopify App Store"),
247
  array(
248
  "image" => "/admin_section/images/reviews_platform_icon/goodreads-img.png",
249
- "name" => "Goodreads")
 
 
 
 
 
 
 
 
 
 
 
 
250
  );
251
 
252
  public function saswp_tooltip_message($meta_field_id){
246
  "name" => "Shopify App Store"),
247
  array(
248
  "image" => "/admin_section/images/reviews_platform_icon/goodreads-img.png",
249
+ "name" => "Goodreads"),
250
+ array(
251
+ "image" => "/admin_section/images/reviews_platform_icon/bark-com-img.png",
252
+ "name" => "bark.com"),
253
+ array(
254
+ "image" => "/admin_section/images/reviews_platform_icon/advieskeuze-nl-img.png",
255
+ "name" => "Advieskeuze.nl"),
256
+ array(
257
+ "image" => "/admin_section/images/reviews_platform_icon/bidvine-img.png",
258
+ "name" => "bidvine"),
259
+ array(
260
+ "image" => "/admin_section/images/reviews_platform_icon/podcasts-img.png",
261
+ "name" => "Podcasts")
262
  );
263
 
264
  public function saswp_tooltip_message($meta_field_id){
admin_section/images/reviews_platform_icon/advieskeuze-nl-img.png ADDED
Binary file
admin_section/images/reviews_platform_icon/bark-com-img.png ADDED
Binary file
admin_section/images/reviews_platform_icon/bidvine-img.png ADDED
Binary file
admin_section/images/reviews_platform_icon/podcasts-img.png ADDED
Binary file
admin_section/structure_admin.php CHANGED
@@ -619,15 +619,19 @@ function saswp_comparison_logic_checker($input, $post){
619
 
620
  $terms = wp_get_post_terms( $post->ID ,$data);
621
 
622
- if(count($terms)>0){
 
 
623
 
624
- foreach ($terms as $key => $termvalue) {
 
 
625
 
626
- $termChoices[] = $termvalue->slug;
627
 
628
- }
629
-
630
- }
631
 
632
  }
633
 
619
 
620
  $terms = wp_get_post_terms( $post->ID ,$data);
621
 
622
+ if(!is_wp_error($terms)){
623
+
624
+ if(count($terms)>0){
625
 
626
+ foreach ($terms as $key => $termvalue) {
627
+
628
+ $termChoices[] = $termvalue->slug;
629
 
630
+ }
631
 
632
+ }
633
+
634
+ }
635
 
636
  }
637
 
modules/gutenberg/assets/blocks/faq.js CHANGED
@@ -12,6 +12,8 @@
12
  var InspectorControls = editor.InspectorControls;
13
  var ToggleControl = components.ToggleControl;
14
  var PanelBody = components.PanelBody;
 
 
15
 
16
  blocks.registerBlockType( 'saswp/faq-block', {
17
  title: __('FAQ (SASWP)', 'schema-and-structured-data-for-wp'),
@@ -29,6 +31,10 @@
29
  type: 'string',
30
  default: 'none'
31
  },
 
 
 
 
32
  toggleList: {
33
  type: 'boolean',
34
  default: false
@@ -337,7 +343,7 @@
337
  ( parseInt(item.index) + 1) + "."
338
  ),
339
  el( RichText, {
340
- tagName: 'p',
341
  className:'saswp-faq-step-title',
342
  placeholder: __('Enter a question', 'schema-and-structured-data-for-wp'),
343
  style: { textAlign: alignment },
@@ -404,7 +410,22 @@
404
  return (value == true ? 'Showing step item as an unordered list': 'Showing step item as an ordered list');
405
  }
406
  },
407
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
408
  )
409
  ),
410
  el(
12
  var InspectorControls = editor.InspectorControls;
13
  var ToggleControl = components.ToggleControl;
14
  var PanelBody = components.PanelBody;
15
+ var SelectControl = components.SelectControl;
16
+
17
 
18
  blocks.registerBlockType( 'saswp/faq-block', {
19
  title: __('FAQ (SASWP)', 'schema-and-structured-data-for-wp'),
31
  type: 'string',
32
  default: 'none'
33
  },
34
+ headingTag: {
35
+ type: 'string',
36
+ default: 'h3'
37
+ },
38
  toggleList: {
39
  type: 'boolean',
40
  default: false
343
  ( parseInt(item.index) + 1) + "."
344
  ),
345
  el( RichText, {
346
+ tagName: attributes.headingTag,
347
  className:'saswp-faq-step-title',
348
  placeholder: __('Enter a question', 'schema-and-structured-data-for-wp'),
349
  style: { textAlign: alignment },
410
  return (value == true ? 'Showing step item as an unordered list': 'Showing step item as an ordered list');
411
  }
412
  },
413
+ ),
414
+ el(SelectControl,{
415
+ value : attributes.headingTag,
416
+ label: __('Heading Tag', 'schema-and-structured-data-for-wp'),
417
+ options:[
418
+ { label: 'H1', value: 'h1' },
419
+ { label: 'H2', value: 'h2' },
420
+ { label: 'H3', value: 'h3' },
421
+ { label: 'H4', value: 'h4' },
422
+ { label: 'H5', value: 'h5' },
423
+ { label: 'H6', value: 'h6' },
424
+ ] ,
425
+ onChange: function(value){
426
+ props.setAttributes( { headingTag: value } );
427
+ }
428
+ }),
429
  )
430
  ),
431
  el(
modules/gutenberg/includes/class-gutenberg.php CHANGED
@@ -395,7 +395,39 @@ class SASWP_Gutenberg {
395
 
396
  if($item['title'] || $item['description']){
397
  echo '<li>';
398
- echo '<strong class="saswp-faq-question-title">'. html_entity_decode(esc_attr($item['title'])).'</strong>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
399
  echo '<p class="saswp-faq-answer-text">'.html_entity_decode(esc_textarea($item['description'])).'</p>';
400
  echo '</li>';
401
  }
395
 
396
  if($item['title'] || $item['description']){
397
  echo '<li>';
398
+
399
+ if(isset($attributes['headingTag'])){
400
+
401
+ switch ($attributes['headingTag']) {
402
+
403
+ case 'h1':
404
+ echo '<h1>'. html_entity_decode(esc_attr($item['title'])).'</h1>';
405
+ break;
406
+ case 'h2':
407
+ echo '<h2>'. html_entity_decode(esc_attr($item['title'])).'</h2>';
408
+ break;
409
+ case 'h3':
410
+ echo '<h3>'. html_entity_decode(esc_attr($item['title'])).'</h3>';
411
+ break;
412
+ case 'h4':
413
+ echo '<h4>'. html_entity_decode(esc_attr($item['title'])).'</h4>';
414
+ break;
415
+ case 'h5':
416
+ echo '<h5>'. html_entity_decode(esc_attr($item['title'])).'</h5>';
417
+ break;
418
+ case 'h6':
419
+ echo '<h6>'. html_entity_decode(esc_attr($item['title'])).'</h6>';
420
+ break;
421
+
422
+ default:
423
+ echo '<h3>'. html_entity_decode(esc_attr($item['title'])).'</h3>';
424
+ break;
425
+ }
426
+
427
+ }else{
428
+ echo '<strong class="saswp-faq-question-title">'. html_entity_decode(esc_attr($item['title'])).'</strong>';
429
+ }
430
+
431
  echo '<p class="saswp-faq-answer-text">'.html_entity_decode(esc_textarea($item['description'])).'</p>';
432
  echo '</li>';
433
  }
modules/reviews/reviews_setup.php CHANGED
@@ -181,9 +181,13 @@ function saswp_reviews_custom_columns_set( $column, $post_id ) {
181
  break;
182
  case 'saswp_review_place_id' :
183
 
184
- $name = get_post_meta( $post_id, $key='saswp_review_location_id', true);
185
- echo '<a target="_blank" href="'.esc_url(get_permalink($name)).'">'.esc_attr($name).'</a>';
186
-
 
 
 
 
187
  break;
188
  case 'saswp_review_shortcode' :
189
 
@@ -353,7 +357,7 @@ function saswp_insert_platform_terms(){
353
 
354
  $platform_inserted = get_transient('saswp_platform_inserted');
355
 
356
- if($platform_inserted != 82){
357
 
358
  $term_array = array(
359
  'Self',
@@ -374,8 +378,11 @@ function saswp_insert_platform_terms(){
374
  'AlternativeTo',
375
  'Amazon',
376
  'BBB',
 
377
  'BestBuy',
378
- 'Booking.com',
 
 
379
  'Capterra',
380
  'CarGurus',
381
  'Cars.com',
@@ -415,6 +422,7 @@ function saswp_insert_platform_terms(){
415
  'Opentable',
416
  'ProductHunt',
417
  'Playstore',
 
418
  'RateMDs',
419
  'ReserveOut',
420
  'Rotten Tomatoes',
@@ -462,8 +470,8 @@ function saswp_insert_platform_terms(){
462
 
463
  }
464
 
465
- if(count($term_ids) == 82){
466
- set_transient('saswp_platform_inserted', 82, 24*7*HOUR_IN_SECONDS );
467
  }
468
 
469
  }
181
  break;
182
  case 'saswp_review_place_id' :
183
 
184
+ $name = get_post_meta( $post_id, 'saswp_review_location_id', true);
185
+ if(saswp_validate_url($name)){
186
+ echo '<a target="_blank" href="'.esc_url($name).'">'.esc_attr($name).'</a>';
187
+ }else{
188
+ echo '<a target="_blank" href="'.esc_url(get_permalink($name)).'">'.esc_attr($name).'</a>';
189
+ }
190
+
191
  break;
192
  case 'saswp_review_shortcode' :
193
 
357
 
358
  $platform_inserted = get_transient('saswp_platform_inserted');
359
 
360
+ if($platform_inserted != 86){
361
 
362
  $term_array = array(
363
  'Self',
378
  'AlternativeTo',
379
  'Amazon',
380
  'BBB',
381
+ 'bidvine',
382
  'BestBuy',
383
+ 'Booking.com',
384
+ 'Bark.com',
385
+ 'advieskeuze.nl',
386
  'Capterra',
387
  'CarGurus',
388
  'Cars.com',
422
  'Opentable',
423
  'ProductHunt',
424
  'Playstore',
425
+ 'Podcasts',
426
  'RateMDs',
427
  'ReserveOut',
428
  'Rotten Tomatoes',
470
 
471
  }
472
 
473
+ if(count($term_ids) == 86){
474
+ set_transient('saswp_platform_inserted', 86, 24*7*HOUR_IN_SECONDS );
475
  }
476
 
477
  }
output/gutenberg.php CHANGED
@@ -746,9 +746,9 @@ function saswp_gutenberg_faq_schema(){
746
 
747
  $supply_data = array();
748
  $supply_data['@type'] = 'Question';
749
- $supply_data['name'] = (isset($val['question'][0]) && is_string($val['question'][0]) ) ? htmlspecialchars($val['question'][0], ENT_QUOTES, 'UTF-8') : '';
750
  $supply_data['acceptedAnswer']['@type'] = 'Answer';
751
- $supply_data['acceptedAnswer']['text'] = (isset($val['answer'][0]) && is_string($val['answer'][0]) ) ? htmlspecialchars($val['answer'][0], ENT_QUOTES, 'UTF-8') : '';
752
 
753
  if(isset($val['answer'][1]['key']) && $val['answer'][1]['key'] !=''){
754
 
746
 
747
  $supply_data = array();
748
  $supply_data['@type'] = 'Question';
749
+ $supply_data['name'] = (isset($val['jsonQuestion']) && is_string($val['jsonQuestion']) ) ? htmlspecialchars($val['jsonQuestion'], ENT_QUOTES, 'UTF-8') : '';
750
  $supply_data['acceptedAnswer']['@type'] = 'Answer';
751
+ $supply_data['acceptedAnswer']['text'] = (isset($val['jsonAnswer']) && is_string($val['jsonAnswer']) ) ? htmlspecialchars($val['jsonAnswer'], ENT_QUOTES, 'UTF-8') : '';
752
 
753
  if(isset($val['answer'][1]['key']) && $val['answer'][1]['key'] !=''){
754
 
output/rest-api/wpgraphql.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WP Graphql Page
4
+ *
5
+ * @author Magazine3
6
+ * @category Output
7
+ * @path output/rest-api/wpgraphql
8
+ * @version 1.9.76
9
+ */
10
+
11
+ if (!defined('ABSPATH')) {
12
+ exit();
13
+ }
14
+
15
+ use WPGraphQL\AppContext;
16
+ add_action( 'graphql_register_types', 'saswp_register_schema_output' );
17
+
18
+ /**
19
+ * Function to extends WP Graph Ql Schema to get generated schema markup for the post types
20
+ * @global type $post
21
+ * @return array
22
+ */
23
+ function saswp_register_schema_output() {
24
+
25
+ register_graphql_object_type( 'saswpSchemaType', [
26
+ 'description' => saswp_t_string( 'Data from Schema & Structured Data for WP & AMP'),
27
+ 'fields' => [
28
+ 'json_ld' => [
29
+ 'type' => 'String',
30
+ 'description' => saswp_t_string( 'Get the whole Json-ld generated by from Schema & Structured Data for WP & AMP' ),
31
+ ]
32
+ ],
33
+ ] );
34
+
35
+ //Get schema data for post query
36
+ $post_types = \WPGraphQL::get_allowed_post_types();
37
+
38
+ if(!empty($post_types) && is_array($post_types)){
39
+
40
+ foreach ($post_types as $post_type) {
41
+
42
+ $post_type_object = get_post_type_object($post_type);
43
+
44
+ if (isset($post_type_object->graphql_single_name)){
45
+
46
+ register_graphql_field( $post_type_object->graphql_single_name, 'saswpSchema', [
47
+
48
+ 'type' => 'saswpSchemaType',
49
+ 'resolve' => function($post, array $args, AppContext $context) {
50
+
51
+ require_once SASWP_PLUGIN_DIR_PATH.'output/rest-api/api-service.php';
52
+ $restApiObj = new SASWP_Output_Rest_Api_Service();
53
+ $response = $restApiObj->get_schema($post->ID);
54
+
55
+ return [ 'json_ld' => json_encode($response, JSON_UNESCAPED_SLASHES )];
56
+
57
+ }
58
+ ]
59
+ );
60
+ }
61
+ }
62
+ }
63
+ }
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.7
6
- Stable tag: 1.9.75
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -120,6 +120,18 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)
120
 
121
  == Changelog ==
122
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  = 1.9.75 (18 May 2021) =
124
 
125
  * Fixed: When the Polylang plugin is active with the front page setup, placement is not working properly. #1420
3
  Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
4
  Requires at least: 3.0
5
  Tested up to: 5.7
6
+ Stable tag: 1.9.76
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.76 (25 May 2021) =
124
+
125
+ * Added: An option for changing the FAQ (SASWP) text to H1 H2 H3 #1382
126
+ * Added: Tutorial Links in every review platform fetch section. #1351
127
+ * Added: bidvine.com review platform. #1341
128
+ * Added: bark.com review platform. #1342
129
+ * Added: Apple Podcasts review platform. #1334
130
+ * Added: advieskeuze.nl review platform. #1419
131
+ * Added: Add Support for WP GraphQL plugin ( https://wordpress.org/plugins/wp-graphql ) #1343
132
+ * Fixed: Event validation issue with Event manager plugin #1422
133
+ * Fixed: Compatibility issue: Error in FQA schema, setup by Yoast gutenberg block #1423
134
+
135
  = 1.9.75 (18 May 2021) =
136
 
137
  * Fixed: When the Polylang plugin is active with the front page setup, placement is not working properly. #1420
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.75
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.75');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
@@ -92,6 +92,7 @@ require_once SASWP_DIR_NAME.'/output/compatibility.php';
92
  //Loading api files
93
 
94
  require_once SASWP_PLUGIN_DIR_PATH.'output/rest-api/api.php';
 
95
 
96
  //Loading Reviews files
97
  require_once SASWP_DIR_NAME.'/modules/divi-builder/extension.php';
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.76
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.76');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
92
  //Loading api files
93
 
94
  require_once SASWP_PLUGIN_DIR_PATH.'output/rest-api/api.php';
95
+ require_once SASWP_PLUGIN_DIR_PATH.'output/rest-api/wpgraphql.php';
96
 
97
  //Loading Reviews files
98
  require_once SASWP_DIR_NAME.'/modules/divi-builder/extension.php';