Schema & Structured Data for WP & AMP - Version 1.9.32

Version Description

(09 Apr 2020) =

  • Added: Property "Transcript" in videoObject schema type #776
  • Added: Property "Last reviewed & Reviewed by" in WebPage schema type #776
  • Added: HowTo schema widget for Elementor #819
  • Enhancement: Q&A schema shoud have option to add more suggested answers. #912
  • Fixed: Notice: date_default_timezone_set(): Timezone ID '' is invalid
  • Fixed: Undefined index: key_3 in admin_section\structure_admin.php on line 295 #921
  • Fixed: LocalBusiness @id field value is not being added in json ld markup #915
  • Fixed: Q&A schema on a bbpress topic page, it outputs the reply's permalink but it should be reply's fragment on the topic page linked using anchor (#) links. #831
Download this release

Release Info

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

Code changes from version 1.9.31 to 1.9.32

admin_section/common-function.php CHANGED
@@ -2564,7 +2564,10 @@ function saswp_format_date_time($date, $time=null){
2564
  $formated = '';
2565
 
2566
  $timezone = get_option('timezone_string');
2567
- date_default_timezone_set($timezone);
 
 
 
2568
 
2569
  if($date && $time){
2570
  $formated = date('c',strtotime($date.' '.$time));
@@ -2963,6 +2966,29 @@ function saswp_post_type_capabilities(){
2963
  return $caplist;
2964
  }
2965
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2966
  function saswp_get_image_by_id($image_id){
2967
 
2968
  $response = array();
2564
  $formated = '';
2565
 
2566
  $timezone = get_option('timezone_string');
2567
+
2568
+ if($timezone){
2569
+ date_default_timezone_set($timezone);
2570
+ }
2571
 
2572
  if($date && $time){
2573
  $formated = date('c',strtotime($date.' '.$time));
2966
  return $caplist;
2967
  }
2968
 
2969
+ function saswp_get_image_by_url($url){
2970
+
2971
+ $response = array();
2972
+
2973
+ if($url){
2974
+
2975
+ $image_details = @getimagesize($url);
2976
+
2977
+ if($image_details){
2978
+
2979
+ $response['@type'] = 'ImageObject';
2980
+ $response['url'] = $url;
2981
+ $response['width'] = $image_details[0];
2982
+ $response['height'] = $image_details[1];
2983
+
2984
+ }
2985
+
2986
+ }
2987
+
2988
+ return $response;
2989
+
2990
+ }
2991
+
2992
  function saswp_get_image_by_id($image_id){
2993
 
2994
  $response = array();
admin_section/structure_admin.php CHANGED
@@ -290,9 +290,9 @@ function saswp_generate_field_data( $post_id ){
290
  function saswp_comparison_logic_checker($input){
291
 
292
  global $post;
293
- $type = $input['key_1'];
294
- $comparison = $input['key_2'];
295
- $data = $input['key_3'];
296
  $result = '';
297
 
298
  // Get all the users registered
290
  function saswp_comparison_logic_checker($input){
291
 
292
  global $post;
293
+ $type = isset($input['key_1']) ? $input['key_1'] : '';
294
+ $comparison = isset($input['key_2']) ? $input['key_2'] : '';
295
+ $data = isset($input['key_3']) ? $input['key_3'] : '';
296
  $result = '';
297
 
298
  // Get all the users registered
core/array-list/repeater-fields.php CHANGED
@@ -38,7 +38,11 @@ return array( 'schema_type_element' => array(
38
  ),
39
  'Event' => array(
40
  'performer' => 'performer',
41
- ),
 
 
 
 
42
  'HowTo' => array(
43
  'how-to-supply' => 'howto_supply',
44
  'how-to-tool' => 'howto_tool',
@@ -196,22 +200,76 @@ return array( 'schema_type_element' => array(
196
  )
197
  ),
198
  'howto_supply' => array(
199
- array(
200
- 'label' => 'Supply Name',
201
- 'name' => 'saswp_howto_supply_name',
202
- 'type' => 'text',
203
- ),
204
- array(
205
- 'label' => 'Supply URL',
206
- 'name' => 'saswp_howto_supply_url',
207
- 'type' => 'text',
208
- ),
209
- array(
210
- 'label' => 'Supply Image',
211
- 'name' => 'saswp_howto_supply_image',
212
- 'type' => 'media',
213
- )
214
- ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  'howto_tool' => array(
216
  array(
217
  'label' => 'Tool Name',
38
  ),
39
  'Event' => array(
40
  'performer' => 'performer',
41
+ ),
42
+ 'qanda' => array(
43
+ 'accepted_answer' => 'accepted_answer',
44
+ 'suggested_answer' => 'suggested_answer'
45
+ ),
46
  'HowTo' => array(
47
  'how-to-supply' => 'howto_supply',
48
  'how-to-tool' => 'howto_tool',
200
  )
201
  ),
202
  'howto_supply' => array(
203
+ array(
204
+ 'label' => 'Supply Name',
205
+ 'name' => 'saswp_howto_supply_name',
206
+ 'type' => 'text',
207
+ ),
208
+ array(
209
+ 'label' => 'Supply URL',
210
+ 'name' => 'saswp_howto_supply_url',
211
+ 'type' => 'text',
212
+ ),
213
+ array(
214
+ 'label' => 'Supply Image',
215
+ 'name' => 'saswp_howto_supply_image',
216
+ 'type' => 'media',
217
+ )
218
+ ),
219
+ 'accepted_answer' => array(
220
+ array(
221
+ 'label' => 'Accepted Answer Text',
222
+ 'name' => 'saswp_qa_accepted_answer_text',
223
+ 'type' => 'text',
224
+ ),
225
+ array(
226
+ 'label' => 'Accepted Answer Date Created',
227
+ 'name' => 'saswp_qa_accepted_answer_date_created',
228
+ 'type' => 'text',
229
+ ),
230
+ array(
231
+ 'label' => 'Accepted Answer Upvote Count',
232
+ 'name' => 'saswp_qa_accepted_answer_upvote_count',
233
+ 'type' => 'number',
234
+ ),
235
+ array(
236
+ 'label' => 'Accepted Answer Url',
237
+ 'name' => 'saswp_qa_accepted_answer_url',
238
+ 'type' => 'text',
239
+ ),
240
+ array(
241
+ 'label' => 'Accepted Answer Author Name',
242
+ 'name' => 'saswp_qa_accepted_author_name',
243
+ 'type' => 'text',
244
+ )
245
+ ),
246
+ 'suggested_answer' => array(
247
+ array(
248
+ 'label' => 'suggested Answer Text',
249
+ 'name' => 'saswp_qa_suggested_answer_text',
250
+ 'type' => 'text',
251
+ ),
252
+ array(
253
+ 'label' => 'suggested Answer Date Created',
254
+ 'name' => 'saswp_qa_suggested_answer_date_created',
255
+ 'type' => 'text',
256
+ ),
257
+ array(
258
+ 'label' => 'suggested Answer Upvote Count',
259
+ 'name' => 'saswp_qa_suggested_answer_upvote_count',
260
+ 'type' => 'number',
261
+ ),
262
+ array(
263
+ 'label' => 'suggested Answer Url',
264
+ 'name' => 'saswp_qa_suggested_answer_url',
265
+ 'type' => 'text',
266
+ ),
267
+ array(
268
+ 'label' => 'suggested Answer Author Name',
269
+ 'name' => 'saswp_qa_suggested_author_name',
270
+ 'type' => 'text',
271
+ )
272
+ ),
273
  'howto_tool' => array(
274
  array(
275
  'label' => 'Tool Name',
core/array-list/schema-properties.php CHANGED
@@ -580,6 +580,18 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
580
  'type' => 'text',
581
  'default' => get_the_modified_date("Y-m-d")
582
  ),
 
 
 
 
 
 
 
 
 
 
 
 
583
  array(
584
  'label' => 'Author Name',
585
  'id' => 'saswp_webpage_author_name_'.$schema_id,
@@ -1835,15 +1847,21 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
1835
  'default' => get_the_modified_date("Y-m-d")
1836
  ),
1837
  array(
1838
- 'label' => 'Description',
1839
- 'id' => 'saswp_video_object_description_'.$schema_id,
1840
- 'type' => 'textarea',
1841
  'default' => get_the_excerpt()
1842
  ),
1843
  array(
1844
- 'label' => 'Name',
1845
- 'id' => 'saswp_video_object_name_'.$schema_id,
1846
- 'type' => 'text',
 
 
 
 
 
 
1847
  'default' => saswp_get_the_title()
1848
  ),
1849
  array(
@@ -2039,58 +2057,7 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
2039
  'label' => 'Answer Count',
2040
  'id' => 'saswp_qa_answer_count_'.$schema_id,
2041
  'type' => 'text',
2042
- ),
2043
- array(
2044
- 'label' => 'Accepted Answer Text',
2045
- 'id' => 'saswp_qa_accepted_answer_text_'.$schema_id,
2046
- 'type' => 'text',
2047
- ),
2048
- array(
2049
- 'label' => 'Accepted Answer Date Created',
2050
- 'id' => 'saswp_qa_accepted_answer_date_created_'.$schema_id,
2051
- 'type' => 'text',
2052
- ),
2053
- array(
2054
- 'label' => 'Accepted Answer Upvote Count',
2055
- 'id' => 'saswp_qa_accepted_answer_upvote_count_'.$schema_id,
2056
- 'type' => 'text',
2057
- ),
2058
- array(
2059
- 'label' => 'Accepted Answer Url',
2060
- 'id' => 'saswp_qa_accepted_answer_url_'.$schema_id,
2061
- 'type' => 'text',
2062
- ),
2063
- array(
2064
- 'label' => 'Accepted Answer Author Name',
2065
- 'id' => 'saswp_qa_accepted_author_name_'.$schema_id,
2066
- 'type' => 'text',
2067
- ),
2068
-
2069
- array(
2070
- 'label' => 'Suggested Answer Text',
2071
- 'id' => 'saswp_qa_suggested_answer_text_'.$schema_id,
2072
- 'type' => 'text',
2073
- ),
2074
- array(
2075
- 'label' => 'Suggested Answer Date Created',
2076
- 'id' => 'saswp_qa_suggested_answer_date_created_'.$schema_id,
2077
- 'type' => 'text',
2078
- ),
2079
- array(
2080
- 'label' => 'Suggested Answer Upvote Count',
2081
- 'id' => 'saswp_qa_suggested_answer_upvote_count_'.$schema_id,
2082
- 'type' => 'text',
2083
- ),
2084
- array(
2085
- 'label' => 'Suggested Answer Url',
2086
- 'id' => 'saswp_qa_suggested_answer_url_'.$schema_id,
2087
- 'type' => 'text',
2088
- ),
2089
- array(
2090
- 'label' => 'Suggested Answer Author Name',
2091
- 'id' => 'saswp_qa_suggested_author_name_'.$schema_id,
2092
- 'type' => 'text',
2093
- ),
2094
 
2095
  );
2096
  break;
580
  'type' => 'text',
581
  'default' => get_the_modified_date("Y-m-d")
582
  ),
583
+ array(
584
+ 'label' => 'Last Reviewed',
585
+ 'id' => 'saswp_webpage_last_reviewed_'.$schema_id,
586
+ 'type' => 'text',
587
+ 'default' => get_the_modified_date("Y-m-d")
588
+ ),
589
+ array(
590
+ 'label' => 'Reviewed By',
591
+ 'id' => 'saswp_webpage_reviewed_by_'.$schema_id,
592
+ 'type' => 'text',
593
+ 'default' => saswp_remove_warnings($sd_data, 'sd_name', 'saswp_string')
594
+ ),
595
  array(
596
  'label' => 'Author Name',
597
  'id' => 'saswp_webpage_author_name_'.$schema_id,
1847
  'default' => get_the_modified_date("Y-m-d")
1848
  ),
1849
  array(
1850
+ 'label' => 'Description',
1851
+ 'id' => 'saswp_video_object_description_'.$schema_id,
1852
+ 'type' => 'textarea',
1853
  'default' => get_the_excerpt()
1854
  ),
1855
  array(
1856
+ 'label' => 'Transcript',
1857
+ 'id' => 'saswp_video_object_transcript_'.$schema_id,
1858
+ 'type' => 'textarea',
1859
+ 'default' => is_object($post) ? wp_strip_all_tags(strip_shortcodes($post->post_content)) : ''
1860
+ ),
1861
+ array(
1862
+ 'label' => 'Name',
1863
+ 'id' => 'saswp_video_object_name_'.$schema_id,
1864
+ 'type' => 'text',
1865
  'default' => saswp_get_the_title()
1866
  ),
1867
  array(
2057
  'label' => 'Answer Count',
2058
  'id' => 'saswp_qa_answer_count_'.$schema_id,
2059
  'type' => 'text',
2060
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2061
 
2062
  );
2063
  break;
modules/elementor/assets/js/how-to-block.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ( function( $ ) {
2
+ /**
3
+ * @param $scope The Widget wrapper element as a jQuery element
4
+ * @param $ The jQuery alias
5
+ */
6
+ var SaswpHowToWidgetHandler = function( $scope, $ ) {
7
+ console.log( $scope );
8
+ };
9
+
10
+ // Make sure you run this code under Elementor.
11
+ $( window ).on( 'elementor/frontend/init', function() {
12
+ elementorFrontend.hooks.addAction( 'frontend/element_ready/how-to-block.default', SaswpHowToWidgetHandler );
13
+ } );
14
+ } )( jQuery );
modules/elementor/elementor-loader.php CHANGED
@@ -46,7 +46,8 @@ class SASWP_Elementor_Loader {
46
  * @access public
47
  */
48
  public function widget_scripts() {
49
- wp_register_script( 'elementor-helloff-world', SASWP_PLUGIN_URL .'/modules/elementor/assets/js/faq-block.js', [ 'jquery' ], false, true );
 
50
  }
51
 
52
  /**
@@ -59,6 +60,7 @@ class SASWP_Elementor_Loader {
59
  */
60
  private function include_widgets_files() {
61
  require_once( __DIR__ . '/widgets/faq-block.php' );
 
62
  }
63
 
64
  /**
@@ -75,6 +77,9 @@ class SASWP_Elementor_Loader {
75
 
76
  // Register Widgets
77
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\Faq_Block() );
 
 
 
78
  }
79
 
80
  /**
46
  * @access public
47
  */
48
  public function widget_scripts() {
49
+ wp_register_script( 'saswp-elementor-faq-widget', SASWP_PLUGIN_URL .'/modules/elementor/assets/js/faq-block.js', [ 'jquery' ], false, true );
50
+ wp_register_script( 'saswp-elementor-how-to-widget', SASWP_PLUGIN_URL .'/modules/elementor/assets/js/how-to-block.js', [ 'jquery' ], false, true );
51
  }
52
 
53
  /**
60
  */
61
  private function include_widgets_files() {
62
  require_once( __DIR__ . '/widgets/faq-block.php' );
63
+ require_once( __DIR__ . '/widgets/how-to-block.php' );
64
  }
65
 
66
  /**
77
 
78
  // Register Widgets
79
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\Faq_Block() );
80
+
81
+ // Register Widgets
82
+ \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\HowTo_Block() );
83
  }
84
 
85
  /**
modules/elementor/widgets/faq-block.php CHANGED
@@ -94,7 +94,7 @@ class Faq_Block extends Widget_Base {
94
 
95
  global $saswp_elementor_faq;
96
 
97
- $settings = $this->get_settings_for_display();
98
  $order_type = $settings['order_type'];
99
  $style ='';
100
 
94
 
95
  global $saswp_elementor_faq;
96
 
97
+ $settings = $this->get_settings_for_display();
98
  $order_type = $settings['order_type'];
99
  $style ='';
100
 
modules/elementor/widgets/how-to-block.php ADDED
@@ -0,0 +1,465 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SASWPElementorModule\Widgets;
3
+
4
+ use Elementor\Repeater;
5
+ use Elementor\Widget_Base;
6
+ use Elementor\Controls_Manager;
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
9
+
10
+
11
+ class HowTo_Block extends Widget_Base {
12
+
13
+ public function get_name() {
14
+ return 'saswp-how-to-block';
15
+ }
16
+
17
+ public function get_title() {
18
+ return __( 'HowTo Block', 'elementor' );
19
+ }
20
+ public function get_keywords() {
21
+ return [ 'howto', 'how to','how to schema', 'schema', 'structured data' ];
22
+ }
23
+ public function get_icon() {
24
+ return 'eicon-text';
25
+ }
26
+
27
+ protected function _register_controls() {
28
+
29
+ $this->start_controls_section(
30
+ 'time_section',
31
+ [
32
+ 'label' => __( 'Time Needed', 'schema-and-structured-data-for-wp' ),
33
+ 'tab' => Controls_Manager::TAB_CONTENT,
34
+ ]
35
+ );
36
+
37
+ $this->add_control(
38
+ 'howto_days',
39
+ [
40
+ 'label' => __( 'Days', 'schema-and-structured-data-for-wp' ),
41
+ 'type' => Controls_Manager::NUMBER,
42
+ 'placeholder' => 'DD'
43
+ ]
44
+ );
45
+
46
+ $this->add_control(
47
+ 'howto_hours',
48
+ [
49
+ 'label' => __( 'Hours', 'schema-and-structured-data-for-wp' ),
50
+ 'type' => Controls_Manager::NUMBER,
51
+ 'placeholder' => 'HH'
52
+ ]
53
+ );
54
+
55
+ $this->add_control(
56
+ 'howto_minutes',
57
+ [
58
+ 'label' => __( 'Minutes', 'schema-and-structured-data-for-wp' ),
59
+ 'type' => Controls_Manager::NUMBER,
60
+ 'placeholder' => 'MM'
61
+ ]
62
+ );
63
+
64
+ $this->end_controls_section();
65
+
66
+ $this->start_controls_section(
67
+ 'cost_section',
68
+ [
69
+ 'label' => __( 'Estimate Cost', 'schema-and-structured-data-for-wp' ),
70
+ 'tab' => Controls_Manager::TAB_CONTENT,
71
+ ]
72
+ );
73
+
74
+ $this->add_control(
75
+ 'howto_currency',
76
+ [
77
+ 'label' => __( 'Currency', 'schema-and-structured-data-for-wp' ),
78
+ 'type' => Controls_Manager::TEXT,
79
+ 'placeholder' => 'USD',
80
+ ]
81
+ );
82
+
83
+ $this->add_control(
84
+ 'howto_price',
85
+ [
86
+ 'label' => __( 'Price', 'schema-and-structured-data-for-wp' ),
87
+ 'type' => Controls_Manager::NUMBER,
88
+ 'placeholder' => '20'
89
+ ]
90
+ );
91
+
92
+ $this->end_controls_section();
93
+
94
+ $this->start_controls_section(
95
+ 'description_section',
96
+ [
97
+ 'label' => __( 'Description', 'schema-and-structured-data-for-wp' ),
98
+ 'tab' => Controls_Manager::TAB_CONTENT,
99
+ ]
100
+ );
101
+
102
+ $this->add_control(
103
+ 'howto_description',
104
+ [
105
+ 'label' => __( 'Description', 'schema-and-structured-data-for-wp' ),
106
+ 'type' => Controls_Manager::TEXTAREA,
107
+ 'placeholder' => __( 'Enter how to description', 'schema-and-structured-data-for-wp' ),
108
+ ]
109
+ );
110
+
111
+ $this->end_controls_section();
112
+
113
+ $this->start_controls_section(
114
+ 'step_section',
115
+ [
116
+ 'label' => __( 'Steps', 'schema-and-structured-data-for-wp' ),
117
+ 'tab' => Controls_Manager::TAB_CONTENT,
118
+ ]
119
+ );
120
+
121
+ $repeater = new Repeater();
122
+
123
+ $repeater->add_control(
124
+ 'howto_step_title', [
125
+ 'label' => __( 'Step', 'schema-and-structured-data-for-wp' ),
126
+ 'type' => Controls_Manager::TEXT,
127
+ 'placeholder' => __( 'Enter step title', 'schema-and-structured-data-for-wp' ),
128
+ 'label_block' => true,
129
+ 'dynamic' => [
130
+ 'active' => true,
131
+ ],
132
+ ]
133
+ );
134
+
135
+ $repeater->add_control(
136
+ 'howto_step_description', [
137
+ 'label' => __( 'Description', 'schema-and-structured-data-for-wp' ),
138
+ 'type' => Controls_Manager::WYSIWYG,
139
+ 'show_label' => false
140
+ ]
141
+ );
142
+
143
+ $this->add_control(
144
+ 'step_list',
145
+ [
146
+ 'label' => __( 'Steps', 'schema-and-structured-data-for-wp' ),
147
+ 'type' => Controls_Manager::REPEATER,
148
+ 'fields' => $repeater->get_controls(),
149
+ 'default' => [
150
+ [
151
+ 'saswp_howto_step_title' => __( 'Step Title', 'schema-and-structured-data-for-wp' ),
152
+ 'saswp_howto_step_description' => __( 'Step Description. Click the edit button to change this text.', 'schema-and-structured-data-for-wp' ),
153
+ ]
154
+ ],
155
+ 'title_field' => '{{{ howto_step_title }}}',
156
+ ]
157
+ );
158
+
159
+ $this->end_controls_section();
160
+
161
+ $this->start_controls_section(
162
+ 'tools_section',
163
+ [
164
+ 'label' => __( 'Tools', 'schema-and-structured-data-for-wp' ),
165
+ 'tab' => Controls_Manager::TAB_CONTENT,
166
+ ]
167
+ );
168
+
169
+ $tool_repeater = new Repeater();
170
+
171
+ $tool_repeater->add_control(
172
+ 'howto_tool_name', [
173
+ 'label' => __( 'Tool Name', 'schema-and-structured-data-for-wp' ),
174
+ 'type' => Controls_Manager::TEXT,
175
+ 'placeholder' => __( 'Enter tool name', 'schema-and-structured-data-for-wp' ),
176
+ 'label_block' => true,
177
+ 'dynamic' => [
178
+ 'active' => true,
179
+ ],
180
+ ]
181
+ );
182
+
183
+ $this->add_control(
184
+ 'tool_list',
185
+ [
186
+ 'label' => __( 'Tool', 'schema-and-structured-data-for-wp' ),
187
+ 'type' => Controls_Manager::REPEATER,
188
+ 'fields' => $tool_repeater->get_controls(),
189
+ 'title_field' => '{{{ howto_tool_name }}}',
190
+ 'prevent_empty' => false
191
+ ]
192
+ );
193
+
194
+ $this->end_controls_section();
195
+
196
+ $this->start_controls_section(
197
+ 'materials_section',
198
+ [
199
+ 'label' => __( 'Materials', 'schema-and-structured-data-for-wp' ),
200
+ 'tab' => Controls_Manager::TAB_CONTENT,
201
+ ]
202
+ );
203
+
204
+ $material_repeater = new Repeater();
205
+
206
+ $material_repeater->add_control(
207
+ 'howto_material_name', [
208
+ 'label' => __( 'Material Name', 'schema-and-structured-data-for-wp' ),
209
+ 'type' => Controls_Manager::TEXT,
210
+ 'placeholder' => __( 'Enter material name', 'schema-and-structured-data-for-wp' ),
211
+ 'label_block' => true,
212
+ 'dynamic' => [
213
+ 'active' => true,
214
+ ],
215
+ ]
216
+ );
217
+
218
+ $this->add_control(
219
+ 'material_list',
220
+ [
221
+ 'label' => __( 'Material', 'schema-and-structured-data-for-wp' ),
222
+ 'type' => Controls_Manager::REPEATER,
223
+ 'fields' => $material_repeater->get_controls(),
224
+ 'title_field' => '{{{ howto_material_name }}}',
225
+ 'prevent_empty' => false
226
+ ]
227
+ );
228
+
229
+ $this->end_controls_section();
230
+
231
+ $this->start_controls_section(
232
+ 'settings_section',
233
+ [
234
+ 'label' => __( 'Settings', 'schema-and-structured-data-for-wp' ),
235
+ 'tab' => Controls_Manager::TAB_CONTENT,
236
+ ]
237
+ );
238
+
239
+ $this->add_control(
240
+ 'order_type',
241
+ [
242
+ 'label' => __( 'Order Type', 'schema-and-structured-data-for-wp' ),
243
+ 'type' => Controls_Manager::SELECT,
244
+ 'options' => [
245
+ '' => __( 'Select', 'schema-and-structured-data-for-wp' ),
246
+ 'order_list' => __( 'Order List', 'schema-and-structured-data-for-wp' ),
247
+ 'unorder_list' => __( 'Unorder List', 'schema-and-structured-data-for-wp' ),
248
+ ],
249
+ ]
250
+ );
251
+
252
+ $this->end_controls_section();
253
+
254
+
255
+ }
256
+
257
+ protected function render() {
258
+
259
+ global $saswp_elementor_howto;
260
+
261
+ $settings = $this->get_settings_for_display();
262
+ $saswp_elementor_howto = $settings;
263
+ $order_type = $settings['order_type'];
264
+ $style = '';
265
+
266
+ if($order_type == 'order_list' || $order_type == ''){
267
+ $style = 'style="list-style:none"';
268
+ }
269
+
270
+ if ( $settings['step_list'] ) {
271
+
272
+ echo '<div class="elementor-how-to-block-content">';
273
+
274
+ if($settings['howto_days'] || $settings['howto_hours'] || $settings['howto_minutes']){
275
+ echo '<div class="elementor-how-to-time-needed">';
276
+ echo '<strong>'.__( 'Time Needed', 'schema-and-structured-data-for-wp' ).' : </strong>';
277
+
278
+ if($settings['howto_days']){
279
+ echo esc_html($settings['howto_days']) .' '. __( 'days', 'schema-and-structured-data-for-wp' ).' ';
280
+ }
281
+ if($settings['howto_hours']){
282
+ echo esc_html($settings['howto_hours']) .' '. __( 'hours', 'schema-and-structured-data-for-wp' ).' ';
283
+ }
284
+ if($settings['howto_minutes']){
285
+ echo esc_html($settings['howto_minutes']) .' '. __( 'minutes', 'schema-and-structured-data-for-wp' );
286
+ }
287
+
288
+ echo '</div>';
289
+ }
290
+
291
+ if($settings['howto_currency'] && $settings['howto_price']){
292
+ echo '<div class="elementor-how-to-estimate-cost">';
293
+ echo '<strong> '.__( 'Estimate Cost', 'schema-and-structured-data-for-wp' ).' : </strong>';
294
+ echo esc_html($settings['howto_currency']). ' '. esc_html($settings['howto_price']);
295
+ echo '</div>';
296
+ }
297
+ if($settings['howto_description']){
298
+ echo '<div class="elementor-how-to-description">';
299
+ echo wp_unslash($settings['howto_description']);
300
+ echo '</div>';
301
+ }
302
+ echo '<div class="elementor-repeater-steps-div">';
303
+ echo '<ul>';
304
+ $i = 1;
305
+ foreach ( $settings['step_list'] as $item ) {
306
+ echo '<li '.$style.' class="elementor-repeater-item-' . esc_attr($item['_id']) . '">';
307
+ echo '<h3>';
308
+
309
+ if($order_type == 'order_list'){
310
+ echo '<span>'.$i.'. </span>';
311
+ }
312
+ echo esc_html($item['howto_step_title']);
313
+ echo '</h3>';
314
+ echo '<p>' . wp_unslash($item['howto_step_description']) . '</p>';
315
+
316
+ $i++;
317
+ }
318
+ echo '</ul>';
319
+ echo '</div>';
320
+
321
+ if($settings['tool_list']){
322
+
323
+ echo '<div class="elementor-repeater-tools-div">';
324
+ echo '<h5>'.__( 'Tools', 'schema-and-structured-data-for-wp' ).'</h5>';
325
+ echo '<ul>';
326
+ $i = 1;
327
+ foreach ( $settings['tool_list'] as $item ) {
328
+ echo '<li '.$style.' class="elementor-repeater-tool-' . esc_attr($item['_id']) . '">';
329
+ echo '<strong>';
330
+
331
+ if($order_type == 'order_list'){
332
+ echo '<span>'.$i.'. </span>';
333
+ }
334
+ echo esc_html($item['howto_tool_name']);
335
+ echo '</strong>';
336
+ $i++;
337
+ }
338
+ echo '</ul>';
339
+ echo '</div>';
340
+
341
+ }
342
+
343
+ if($settings['material_list']){
344
+
345
+ echo '<div class="elementor-repeater-material-div">';
346
+ echo '<h5>'.__( 'Material', 'schema-and-structured-data-for-wp' ).'</h5>';
347
+ echo '<ul>';
348
+ $i = 1;
349
+ foreach ( $settings['material_list'] as $item ) {
350
+ echo '<li '.$style.' class="elementor-repeater-material-' . esc_attr($item['_id']) . '">';
351
+ echo '<strong>';
352
+
353
+ if($order_type == 'order_list'){
354
+ echo '<span>'.$i.'. </span>';
355
+ }
356
+ echo esc_html($item['howto_material_name']);
357
+ echo '</strong>';
358
+ $i++;
359
+ }
360
+ echo '</ul>';
361
+ echo '</div>';
362
+
363
+ }
364
+
365
+ echo '</div>';
366
+ }
367
+ }
368
+
369
+ protected function _content_template() {
370
+ ?>
371
+ <# if ( settings.step_list.length ) {
372
+
373
+ var order_type = settings['order_type'];
374
+ var step_style = '';
375
+
376
+ if(order_type == 'order_list' || order_type == ''){
377
+ step_style = 'style="list-style:none"';
378
+ }
379
+
380
+ #>
381
+ <div class="elementor-how-to-block-content">
382
+ <# if(settings['howto_days'] || settings['howto_hours'] || settings['howto_minutes']) { #>
383
+ <div class="elementor-how-to-time-needed">
384
+ <strong>Time Needed : </strong>
385
+ <# if(settings['howto_days']) { #>
386
+ {{{ settings['howto_days'] }}} days
387
+ <# } #>
388
+ <# if(settings['howto_hours']) { #>
389
+ {{{ settings['howto_hours'] }}} hours
390
+ <# } #>
391
+ <# if(settings['howto_minutes']) { #>
392
+ {{{ settings['howto_minutes'] }}} minutes
393
+ <# } #>
394
+ </div>
395
+ <# } #>
396
+
397
+ <# if(settings['howto_currency'] && settings['howto_price']) { #>
398
+ <div class="elementor-how-to-estimate-cost">
399
+ <strong>Estimate Cost : </strong>
400
+ {{{ settings['howto_currency'] }}}
401
+ {{{ settings['howto_price']}}}
402
+ </div>
403
+ <# } #>
404
+
405
+ <# if(settings['howto_description']) { #>
406
+ <div class="elementor-how-to-description">
407
+ {{{ settings['howto_description'] }}}
408
+ </div>
409
+ <# } #>
410
+ <div class="elementor-repeater-steps-div">
411
+ <ul>
412
+ <# _.each( settings.step_list, function( item, index ) { #>
413
+ <li {{{step_style}}} class="elementor-repeater-item-{{ item._id }}">
414
+ <h3>
415
+ <# if(order_type == 'order_list'){ #>
416
+ <span>{{{ index + 1 }}} .</span>
417
+ <# } #>
418
+ {{{ item.howto_step_title }}}
419
+ </h3>
420
+ <p>{{{ item.howto_step_description }}}</p>
421
+ </li>
422
+ <# }); #>
423
+ </ul>
424
+ </div>
425
+
426
+ <# if(settings.tool_list) { #>
427
+ <div class="elementor-repeater-tools-div">
428
+ <h5>Tools</h5>
429
+ <ul>
430
+ <# _.each( settings.tool_list, function( item, index ) { #>
431
+ <li {{{step_style}}} class="elementor-reapter-tool-{{ item._id }}">
432
+ <strong>
433
+ <# if(order_type == 'order_list'){ #>
434
+ <span>{{{ index + 1 }}} .</span>
435
+ <# } #>
436
+ {{{ item.howto_tool_name }}}
437
+ </strong>
438
+ </li>
439
+ <# }); #>
440
+ </ul>
441
+ </div>
442
+ <# } #>
443
+
444
+ <# if(settings.material_list) { #>
445
+ <div class="elementor-repeater-material-div">
446
+ <h5>Material</h5>
447
+ <ul>
448
+ <# _.each( settings.material_list, function( item, index ) { #>
449
+ <li {{{step_style}}} class="elementor-repeater-material-{{ item._id }}">
450
+ <strong>
451
+ <# if(order_type == 'order_list'){ #>
452
+ <span>{{{ index + 1 }}} .</span>
453
+ <# } #>
454
+ {{{ item.howto_material_name }}}
455
+ </strong>
456
+ </li>
457
+ <# }); #>
458
+ </ul>
459
+ </div>
460
+ <# } #>
461
+ </div>
462
+ <# } #>
463
+ <?php
464
+ }
465
+ }
output/elementor.php CHANGED
@@ -43,6 +43,152 @@ function saswp_elementor_faq_schema(){
43
 
44
  }
45
 
46
- return $input1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
43
 
44
  }
45
 
46
+ return $input1;
47
+ }
48
+
49
+
50
+ /**
51
+ * Function to generate schema markup for elementor HowTo block
52
+ * @global type $post
53
+ * @global type $saswp_elementor_howto
54
+ * @return type array
55
+ */
56
+ function saswp_elementor_howto_schema(){
57
+
58
+ $input1 = array();
59
+
60
+ global $post, $saswp_elementor_howto;
61
+
62
+ if($saswp_elementor_howto){
63
+
64
+ $howto_description = '';
65
+ $step_list = $tool_list = $material_list = array();
66
+
67
+ if(isset($saswp_elementor_howto['step_list'])){
68
+ $step_list = $saswp_elementor_howto['step_list'];
69
+ }
70
+ if(isset($saswp_elementor_howto['tool_list'])){
71
+ $tool_list = $saswp_elementor_howto['tool_list'];
72
+ }
73
+ if(isset($saswp_elementor_howto['material_list'])){
74
+ $material_list = $saswp_elementor_howto['material_list'];
75
+ }
76
+ if(isset($saswp_elementor_howto['howto_description'])){
77
+ $howto_description = $saswp_elementor_howto['howto_description'];
78
+ }
79
+
80
+ $input1['@context'] = saswp_context_url();
81
+ $input1['@type'] = 'HowTo';
82
+ $input1['@id'] = trailingslashit(saswp_get_permalink()).'#HowTo';
83
+ $input1['name'] = saswp_get_the_title();
84
+ $input1['datePublished'] = get_the_date("c");
85
+ $input1['dateModified'] = get_the_modified_date("c");
86
+ $input1['description'] = $howto_description;
87
+
88
+ if(!empty($material_list)){
89
+
90
+ foreach($material_list as $val){
91
+
92
+ $supply_data = array();
93
 
94
+ if($val['howto_material_name']){
95
+ $supply_data['@type'] = 'HowToSupply';
96
+ $supply_data['name'] = $val['howto_material_name'];
97
+ }
98
+
99
+ $supply_arr[] = $supply_data;
100
+ }
101
+ $input1['supply'] = $supply_arr;
102
+ }
103
+
104
+ $tool = array();
105
+ $tool_arr = array();
106
+
107
+ if(!empty($tool_list)){
108
+
109
+ foreach($tool_list as $val){
110
+
111
+ $supply_data = array();
112
+
113
+ if($val['howto_tool_name']){
114
+ $supply_data['@type'] = 'HowToTool';
115
+ $supply_data['name'] = $val['howto_tool_name'];
116
+ }
117
+
118
+ $tool_arr[] = $supply_data;
119
+ }
120
+ $input1['tool'] = $tool_arr;
121
+ }
122
+
123
+ $step = array();
124
+ $step_arr = array();
125
+
126
+ if(!empty($step_list)){
127
+
128
+ foreach($step_list as $key => $val){
129
+
130
+ $supply_data = array();
131
+ $direction = array();
132
+ $tip = array();
133
+
134
+ if($val['howto_step_title'] || $val['howto_step_description']){
135
+
136
+ if($val['howto_step_description']){
137
+ $direction['@type'] = 'HowToDirection';
138
+ $direction['text'] = $val['howto_step_description'];
139
+ }
140
+
141
+ if($val['howto_step_description']){
142
+
143
+ $tip['@type'] = 'HowToTip';
144
+ $tip['text'] = $val['howto_step_description'];
145
+
146
+ }
147
+
148
+ $supply_data['@type'] = 'HowToStep';
149
+ $supply_data['url'] = trailingslashit(saswp_get_permalink()).'#step'.++$key;
150
+ $supply_data['name'] = $val['howto_step_title'];
151
+
152
+ if(isset($direction['text']) || isset($tip['text'])){
153
+ $supply_data['itemListElement'] = array($direction, $tip);
154
+ }
155
+
156
+ $regex = '/<img(.*?)src="(.*?)"(.*?)>/';
157
+ @preg_match_all( $regex, $val['howto_step_description'], $match , PREG_SET_ORDER);
158
+
159
+ if(isset($match[0][2])){
160
+
161
+ $image_details = saswp_get_image_by_url($match[0][2]);
162
+ if($image_details){
163
+ $supply_data['image'] = $image_details;
164
+ }
165
+ }
166
+ $step_arr[] = $supply_data;
167
+
168
+ }
169
+
170
+ }
171
+
172
+ $input1['step'] = $step_arr;
173
+
174
+ }
175
+
176
+ if(isset($saswp_elementor_howto['howto_days']) || isset($saswp_elementor_howto['howto_hours']) || isset($saswp_elementor_howto['howto_minutes'])){
177
+
178
+ $input1['totalTime'] = 'P'.
179
+ ((isset($saswp_elementor_howto['howto_days']) && $saswp_elementor_howto['howto_days'] !='') ? esc_attr($saswp_elementor_howto['howto_days']).'DT':'').
180
+ ((isset($saswp_elementor_howto['howto_hours']) && $saswp_elementor_howto['howto_hours'] !='') ? esc_attr($saswp_elementor_howto['howto_hours']).'H':'').
181
+ ((isset($saswp_elementor_howto['howto_minutes']) && $saswp_elementor_howto['howto_minutes'] !='') ? esc_attr($saswp_elementor_howto['howto_minutes']).'M':'');
182
+
183
+ }
184
+
185
+ if(isset($saswp_elementor_howto['howto_currency']) && isset($saswp_elementor_howto['howto_price'])){
186
+
187
+ $input1['estimatedCost']['@type'] = 'MonetaryAmount';
188
+ $input1['estimatedCost']['currency']= $saswp_elementor_howto['howto_currency'];
189
+ $input1['estimatedCost']['value'] = $saswp_elementor_howto['howto_price'];
190
+ }
191
+ }
192
+
193
+ return $input1;
194
  }
output/function.php CHANGED
@@ -75,9 +75,9 @@ function saswp_wp_hook_operation(){
75
 
76
  function saswp_schema_markup_output_in_buffer($content){
77
 
78
- global $saswp_post_reviews, $saswp_elementor_faq, $saswp_divi_faq;
79
 
80
- if($saswp_post_reviews || $saswp_elementor_faq || $saswp_divi_faq){
81
 
82
  $saswp_json_ld = saswp_get_all_schema_markup_output();
83
 
@@ -144,6 +144,7 @@ function saswp_get_all_schema_markup_output() {
144
  $gutenberg_how_to = saswp_gutenberg_how_to_schema();
145
  $gutenberg_faq = saswp_gutenberg_faq_schema();
146
  $elementor_faq = saswp_elementor_faq_schema();
 
147
  $divi_builder_faq = saswp_divi_builder_faq_schema();
148
  $gutenberg_event = saswp_gutenberg_event_schema();
149
  $gutenberg_job = saswp_gutenberg_job_schema();
@@ -248,6 +249,12 @@ function saswp_get_all_schema_markup_output() {
248
  $output .= ",";
249
  $output .= "\n\n";
250
  }
 
 
 
 
 
 
251
  if(!empty($divi_builder_faq)){
252
 
253
  $output .= saswp_json_print_format($divi_builder_faq);
@@ -1916,7 +1923,7 @@ function saswp_get_modified_markup($input1, $schema_type, $schema_post_id, $sche
1916
  case 'local_business':
1917
 
1918
  $data = saswp_local_business_schema_markup($schema_post_id, $schema_post_id, $all_post_meta);
1919
- $input1 = array_merge($data, $input1);
1920
 
1921
  break;
1922
 
75
 
76
  function saswp_schema_markup_output_in_buffer($content){
77
 
78
+ global $saswp_post_reviews, $saswp_elementor_faq, $saswp_divi_faq, $saswp_elementor_howto;
79
 
80
+ if($saswp_post_reviews || $saswp_elementor_faq || $saswp_divi_faq || $saswp_elementor_howto){
81
 
82
  $saswp_json_ld = saswp_get_all_schema_markup_output();
83
 
144
  $gutenberg_how_to = saswp_gutenberg_how_to_schema();
145
  $gutenberg_faq = saswp_gutenberg_faq_schema();
146
  $elementor_faq = saswp_elementor_faq_schema();
147
+ $elementor_howto = saswp_elementor_howto_schema();
148
  $divi_builder_faq = saswp_divi_builder_faq_schema();
149
  $gutenberg_event = saswp_gutenberg_event_schema();
150
  $gutenberg_job = saswp_gutenberg_job_schema();
249
  $output .= ",";
250
  $output .= "\n\n";
251
  }
252
+ if(!empty($elementor_howto)){
253
+
254
+ $output .= saswp_json_print_format($elementor_howto);
255
+ $output .= ",";
256
+ $output .= "\n\n";
257
+ }
258
  if(!empty($divi_builder_faq)){
259
 
260
  $output .= saswp_json_print_format($divi_builder_faq);
1923
  case 'local_business':
1924
 
1925
  $data = saswp_local_business_schema_markup($schema_post_id, $schema_post_id, $all_post_meta);
1926
+ $input1 = array_merge($input1, $data);
1927
 
1928
  break;
1929
 
output/markup.php CHANGED
@@ -1957,36 +1957,66 @@ function saswp_qanda_schema_markup($schema_id, $schema_post_id, $all_post_meta){
1957
 
1958
  }else{
1959
 
1960
- $input1 = array(
1961
- '@context' => saswp_context_url(),
1962
- '@type' => 'QAPage',
1963
- '@id' => trailingslashit(get_permalink()).'#qapage',
1964
- 'mainEntity' => array(
1965
- '@type' => 'Question' ,
1966
- 'name' => saswp_remove_warnings($all_post_meta, 'saswp_qa_question_title_'.$schema_id, 'saswp_array'),
1967
- 'text' => saswp_remove_warnings($all_post_meta, 'saswp_qa_question_description_'.$schema_id, 'saswp_array'),
1968
- 'upvoteCount' => saswp_remove_warnings($all_post_meta, 'saswp_qa_upvote_count_'.$schema_id, 'saswp_array'),
1969
- 'dateCreated' => isset($all_post_meta['saswp_qa_date_created_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_qa_date_created_'.$schema_id][0])):'',
1970
- 'author' => array('@type' => 'Person','name' =>saswp_remove_warnings($all_post_meta, 'saswp_qa_question_author_name_'.$schema_id, 'saswp_array')) ,
1971
- 'answerCount' => 2 ,
1972
- 'acceptedAnswer' => array(
1973
- '@type' => 'Answer',
1974
- 'upvoteCount' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_answer_upvote_count_'.$schema_id, 'saswp_array'),
1975
- 'url' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_answer_url_'.$schema_id, 'saswp_array'),
1976
- 'text' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_answer_text_'.$schema_id, 'saswp_array'),
1977
- 'dateCreated' => isset($all_post_meta['saswp_qa_accepted_answer_date_created_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_qa_accepted_answer_date_created_'.$schema_id][0])):'',
1978
- 'author' => array('@type' => 'Person', 'name' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_author_name_'.$schema_id, 'saswp_array')),
1979
- ) ,
1980
- 'suggestedAnswer' => array(
1981
- '@type' => 'Answer',
1982
- 'upvoteCount' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_answer_upvote_count_'.$schema_id, 'saswp_array'),
1983
- 'url' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_answer_url_'.$schema_id, 'saswp_array'),
1984
- 'text' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_answer_text_'.$schema_id, 'saswp_array'),
1985
- 'dateCreated' => isset($all_post_meta['saswp_qa_suggested_answer_date_created_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_qa_suggested_answer_date_created_'.$schema_id][0])):'',
1986
- 'author' => array('@type' => 'Person', 'name' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_author_name_'.$schema_id, 'saswp_array')),
1987
- ) ,
1988
- )
1989
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1990
  }
1991
 
1992
  return $input1;
@@ -2188,6 +2218,17 @@ function saswp_webpage_schema_markup($schema_id, $schema_post_id, $all_post_meta
2188
  'inLanguage' => get_bloginfo('language'),
2189
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_name_'.$schema_id, 'saswp_array'),
2190
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_url_'.$schema_id, 'saswp_array'),
 
 
 
 
 
 
 
 
 
 
 
2191
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_description_'.$schema_id, 'saswp_array'),
2192
  'mainEntity' => array(
2193
  '@type' => 'Article',
@@ -2467,14 +2508,15 @@ function saswp_video_object_schema_markup($schema_id, $schema_post_id, $all_post
2467
  $author_image = get_post_meta( get_the_ID(), 'saswp_video_object_author_image_'.$schema_id.'_detail',true);
2468
 
2469
  $input1 = array(
2470
- '@context' => saswp_context_url(),
2471
- '@type' => 'VideoObject',
2472
  '@id' => trailingslashit(get_permalink()).'#videoobject',
2473
- 'url' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_url_'.$schema_id, 'saswp_array'),
2474
- 'headline' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_headline_'.$schema_id, 'saswp_array'),
2475
  'datePublished' => isset($all_post_meta['saswp_video_object_date_published_'.$schema_id])? saswp_format_date_time($all_post_meta['saswp_video_object_date_published_'.$schema_id][0], get_post_time('h:i:s')) :'',
2476
  'dateModified' => isset($all_post_meta['saswp_video_object_date_modified_'.$schema_id])? saswp_format_date_time($all_post_meta['saswp_video_object_date_modified_'.$schema_id][0], get_the_modified_time('h:i:s')) :'',
2477
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_description_'.$schema_id, 'saswp_array'),
 
2478
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_name_'.$schema_id, 'saswp_array'),
2479
  'uploadDate' => isset($all_post_meta['saswp_video_object_upload_date_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_video_object_upload_date_'.$schema_id][0])):'',
2480
  'thumbnailUrl' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_thumbnail_url_'.$schema_id, 'saswp_array'),
1957
 
1958
  }else{
1959
 
1960
+ $input1['@context'] = saswp_context_url();
1961
+ $input1['@type'] = 'QAPage';
1962
+ $input1['@id'] = trailingslashit(get_permalink()).'#qapage';
1963
+
1964
+ $input1['mainEntity']['@type'] = 'Question';
1965
+ $input1['mainEntity']['name'] = saswp_remove_warnings($all_post_meta, 'saswp_qa_question_title_'.$schema_id, 'saswp_array');
1966
+ $input1['mainEntity']['text'] = saswp_remove_warnings($all_post_meta, 'saswp_qa_question_description_'.$schema_id, 'saswp_array');
1967
+ $input1['mainEntity']['upvoteCount'] = saswp_remove_warnings($all_post_meta, 'saswp_qa_upvote_count_'.$schema_id, 'saswp_array');
1968
+ $input1['mainEntity']['dateCreated'] = isset($all_post_meta['saswp_qa_date_created_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_qa_date_created_'.$schema_id][0])):'';
1969
+ $input1['mainEntity']['author'] = array('@type' => 'Person','name' =>saswp_remove_warnings($all_post_meta, 'saswp_qa_question_author_name_'.$schema_id, 'saswp_array'));
1970
+ $input1['mainEntity']['answerCount'] = saswp_remove_warnings($all_post_meta, 'saswp_qa_answer_count_'.$schema_id, 'saswp_array');
1971
+
1972
+ $answer = get_post_meta($schema_post_id, 'accepted_answer_'.$schema_id, true);
1973
+
1974
+ $answer_arr = array();
1975
+
1976
+ if(!empty($answer)){
1977
+
1978
+ foreach($answer as $val){
1979
+
1980
+ $supply_data = array();
1981
+
1982
+ if($val['saswp_qa_accepted_answer_text']){
1983
+ $supply_data['@type'] = 'Answer';
1984
+ $supply_data['upvoteCount'] = $val['saswp_qa_accepted_answer_upvote_count'];
1985
+ $supply_data['url'] = $val['saswp_qa_accepted_answer_url'];
1986
+ $supply_data['text'] = $val['saswp_qa_accepted_answer_text'];
1987
+ $supply_data['dateCreated'] = saswp_format_date_time($val['saswp_qa_accepted_answer_date_created']);
1988
+ $supply_data['author'] = $val['saswp_qa_accepted_author_name'];
1989
+ }
1990
+
1991
+ $answer_arr[] = $supply_data;
1992
+ }
1993
+ $input1['mainEntity']['acceptedAnswer'] = $answer_arr;
1994
+ }
1995
+
1996
+ $answer = get_post_meta($schema_post_id, 'suggested_answer_'.$schema_id, true);
1997
+
1998
+ $answer_arr = array();
1999
+
2000
+ if(!empty($answer)){
2001
+
2002
+ foreach($answer as $val){
2003
+
2004
+ $supply_data = array();
2005
+
2006
+ if($val['saswp_qa_suggested_answer_text']){
2007
+ $supply_data['@type'] = 'Answer';
2008
+ $supply_data['upvoteCount'] = $val['saswp_qa_suggested_answer_upvote_count'];
2009
+ $supply_data['url'] = $val['saswp_qa_suggested_answer_url'];
2010
+ $supply_data['text'] = $val['saswp_qa_suggested_answer_text'];
2011
+ $supply_data['dateCreated'] = saswp_format_date_time($val['saswp_qa_suggested_answer_date_created']);
2012
+ $supply_data['author'] = $val['saswp_qa_suggested_author_name'];
2013
+ }
2014
+
2015
+ $answer_arr[] = $supply_data;
2016
+ }
2017
+ $input1['mainEntity']['suggestedAnswer'] = $answer_arr;
2018
+ }
2019
+
2020
  }
2021
 
2022
  return $input1;
2218
  'inLanguage' => get_bloginfo('language'),
2219
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_name_'.$schema_id, 'saswp_array'),
2220
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_url_'.$schema_id, 'saswp_array'),
2221
+ 'lastReviewed' => isset($all_post_meta['saswp_webpage_last_reviewed_'.$schema_id])? saswp_format_date_time($all_post_meta['saswp_webpage_last_reviewed_'.$schema_id][0], get_post_time('h:i:s')) :'',
2222
+ 'reviewedBy' => array(
2223
+ '@type' => 'Organization',
2224
+ 'logo' => array(
2225
+ '@type' => 'ImageObject',
2226
+ 'url' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_organization_logo_'.$schema_id, 'saswp_array'),
2227
+ 'width' => saswp_remove_warnings($slogo, 'width', 'saswp_string'),
2228
+ 'height' => saswp_remove_warnings($slogo, 'height', 'saswp_string'),
2229
+ ),
2230
+ 'name' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_organization_name_'.$schema_id, 'saswp_array'),
2231
+ ),
2232
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_description_'.$schema_id, 'saswp_array'),
2233
  'mainEntity' => array(
2234
  '@type' => 'Article',
2508
  $author_image = get_post_meta( get_the_ID(), 'saswp_video_object_author_image_'.$schema_id.'_detail',true);
2509
 
2510
  $input1 = array(
2511
+ '@context' => saswp_context_url(),
2512
+ '@type' => 'VideoObject',
2513
  '@id' => trailingslashit(get_permalink()).'#videoobject',
2514
+ 'url' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_url_'.$schema_id, 'saswp_array'),
2515
+ 'headline' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_headline_'.$schema_id, 'saswp_array'),
2516
  'datePublished' => isset($all_post_meta['saswp_video_object_date_published_'.$schema_id])? saswp_format_date_time($all_post_meta['saswp_video_object_date_published_'.$schema_id][0], get_post_time('h:i:s')) :'',
2517
  'dateModified' => isset($all_post_meta['saswp_video_object_date_modified_'.$schema_id])? saswp_format_date_time($all_post_meta['saswp_video_object_date_modified_'.$schema_id][0], get_the_modified_time('h:i:s')) :'',
2518
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_description_'.$schema_id, 'saswp_array'),
2519
+ 'transcript' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_transcript_'.$schema_id, 'saswp_array'),
2520
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_name_'.$schema_id, 'saswp_array'),
2521
  'uploadDate' => isset($all_post_meta['saswp_video_object_upload_date_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_video_object_upload_date_'.$schema_id][0])):'',
2522
  'thumbnailUrl' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_thumbnail_url_'.$schema_id, 'saswp_array'),
output/output.php CHANGED
@@ -1293,6 +1293,7 @@ function saswp_schema_output() {
1293
  'datePublished' => esc_html($date),
1294
  'dateModified' => esc_html($modified_date),
1295
  'description' => $description,
 
1296
  'name' => saswp_get_the_title(),
1297
  'uploadDate' => esc_html($date),
1298
  'thumbnailUrl' => $thumbnail,
1293
  'datePublished' => esc_html($date),
1294
  'dateModified' => esc_html($modified_date),
1295
  'description' => $description,
1296
+ 'transcript' => saswp_get_the_content(),
1297
  'name' => saswp_get_the_title(),
1298
  'uploadDate' => esc_html($date),
1299
  'thumbnailUrl' => $thumbnail,
output/service.php CHANGED
@@ -954,13 +954,21 @@ Class saswp_output_service{
954
  case 'WebPage':
955
 
956
  if(isset($custom_fields['saswp_webpage_name'])){
957
- $input1['name'] = $custom_fields['saswp_webpage_name'];
958
  }
959
  if(isset($custom_fields['saswp_webpage_url'])){
960
- $input1['url'] = $custom_fields['saswp_webpage_url'];
961
  }
962
  if(isset($custom_fields['saswp_webpage_description'])){
963
- $input1['description'] = wp_strip_all_tags(strip_shortcodes( $custom_fields['saswp_webpage_description'] )) ;
 
 
 
 
 
 
 
 
964
  }
965
 
966
  if(isset($custom_fields['saswp_webpage_main_entity_of_page'])){
@@ -1463,6 +1471,9 @@ Class saswp_output_service{
1463
  if(isset($custom_fields['saswp_video_object_description'])){
1464
  $input1['description'] = wp_strip_all_tags(strip_shortcodes( $custom_fields['saswp_video_object_description'] ));
1465
  }
 
 
 
1466
  if(isset($custom_fields['saswp_video_object_name'])){
1467
  $input1['name'] = $custom_fields['saswp_video_object_name'];
1468
  }
@@ -2721,7 +2732,7 @@ Class saswp_output_service{
2721
  $suggested_answer[] = array(
2722
  '@type' => 'Answer',
2723
  'upvoteCount' => 1,
2724
- 'url' => get_permalink($answer->ID),
2725
  'text' => wp_strip_all_tags($answer->post_content),
2726
  'dateCreated' => get_the_date("Y-m-d\TH:i:s\Z", $answer),
2727
  'author' => array('@type' => 'Person', 'name' => $authorinfo->data->user_nicename),
@@ -2975,10 +2986,21 @@ Class saswp_output_service{
2975
  $input1 = array(
2976
  '@context' => saswp_context_url(),
2977
  '@type' => 'WebPage' ,
2978
- '@id' => trailingslashit(saswp_get_permalink()).'#webpage',
2979
  'name' => saswp_get_the_title(),
2980
- 'url' => saswp_get_permalink(),
2981
- 'inLanguage' => get_bloginfo('language'),
 
 
 
 
 
 
 
 
 
 
 
2982
  'description' => saswp_get_the_excerpt(),
2983
  'mainEntity' => array(
2984
  '@type' => 'Article',
954
  case 'WebPage':
955
 
956
  if(isset($custom_fields['saswp_webpage_name'])){
957
+ $input1['name'] = $custom_fields['saswp_webpage_name'];
958
  }
959
  if(isset($custom_fields['saswp_webpage_url'])){
960
+ $input1['url'] = $custom_fields['saswp_webpage_url'];
961
  }
962
  if(isset($custom_fields['saswp_webpage_description'])){
963
+ $input1['description'] = wp_strip_all_tags(strip_shortcodes( $custom_fields['saswp_webpage_description'] )) ;
964
+ }
965
+
966
+ if(isset($custom_fields['saswp_webpage_reviewed_by'])){
967
+ $input1['reviewedBy'] = $custom_fields['saswp_webpage_reviewed_by'];
968
+ }
969
+
970
+ if(isset($custom_fields['saswp_webpage_last_reviewed'])){
971
+ $input1['lastReviewed'] = $custom_fields['saswp_webpage_last_reviewed'];
972
  }
973
 
974
  if(isset($custom_fields['saswp_webpage_main_entity_of_page'])){
1471
  if(isset($custom_fields['saswp_video_object_description'])){
1472
  $input1['description'] = wp_strip_all_tags(strip_shortcodes( $custom_fields['saswp_video_object_description'] ));
1473
  }
1474
+ if(isset($custom_fields['saswp_video_object_transcript'])){
1475
+ $input1['transcript'] = wp_strip_all_tags(strip_shortcodes( $custom_fields['saswp_video_object_transcript'] ));
1476
+ }
1477
  if(isset($custom_fields['saswp_video_object_name'])){
1478
  $input1['name'] = $custom_fields['saswp_video_object_name'];
1479
  }
2732
  $suggested_answer[] = array(
2733
  '@type' => 'Answer',
2734
  'upvoteCount' => 1,
2735
+ 'url' => get_permalink().'#post-'.$answer->ID,
2736
  'text' => wp_strip_all_tags($answer->post_content),
2737
  'dateCreated' => get_the_date("Y-m-d\TH:i:s\Z", $answer),
2738
  'author' => array('@type' => 'Person', 'name' => $authorinfo->data->user_nicename),
2986
  $input1 = array(
2987
  '@context' => saswp_context_url(),
2988
  '@type' => 'WebPage' ,
2989
+ '@id' => trailingslashit(saswp_get_permalink()).'#webpage',
2990
  'name' => saswp_get_the_title(),
2991
+ 'url' => saswp_get_permalink(),
2992
+ 'lastReviewed' => esc_html($modified_date),
2993
+ 'reviewedBy' => array(
2994
+ '@type' => 'Organization',
2995
+ 'logo' => array(
2996
+ '@type' => 'ImageObject',
2997
+ 'url' => esc_url($logo),
2998
+ 'width' => esc_attr($width),
2999
+ 'height' => esc_attr($height),
3000
+ ),
3001
+ 'name' => esc_attr($site_name),
3002
+ ),
3003
+ 'inLanguage' => get_bloginfo('language'),
3004
  'description' => saswp_get_the_excerpt(),
3005
  'mainEntity' => array(
3006
  '@type' => 'Article',
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.4
6
- Stable tag: 1.9.31
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -118,6 +118,18 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)
118
 
119
  == Changelog ==
120
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  = 1.9.31 (02 Apr 2020) =
122
 
123
  * Fixed: Select2 is not a function #904
3
  Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
4
  Requires at least: 3.0
5
  Tested up to: 5.4
6
+ Stable tag: 1.9.32
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
118
 
119
  == Changelog ==
120
 
121
+ = 1.9.32 (09 Apr 2020) =
122
+
123
+ * Added: Property "Transcript" in videoObject schema type #776
124
+ * Added: Property "Last reviewed & Reviewed by" in WebPage schema type #776
125
+ * Added: HowTo schema widget for Elementor #819
126
+ * Enhancement: Q&A schema shoud have option to add more suggested answers. #912
127
+ * Fixed: Notice: date_default_timezone_set(): Timezone ID '' is invalid
128
+ * Fixed: Undefined index: key_3 in admin_section\structure_admin.php on line 295 #921
129
+ * Fixed: LocalBusiness @id field value is not being added in json ld markup #915
130
+ * Fixed: Q&A schema on a bbpress topic page, it outputs the reply's permalink but it should be reply's fragment on the topic page linked using anchor (#) links. #831
131
+
132
+
133
  = 1.9.31 (02 Apr 2020) =
134
 
135
  * Fixed: Select2 is not a function #904
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.31
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.31');
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.32
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.32');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));