Schema & Structured Data for WP & AMP - Version 1.0.9

Version Description

(07 February 2019) =

  • New Feature: SiteNavigationElement schema type add to the schema type list #115
  • Added: Option to edit the Schema type for Archive page #123
  • Added: Menu Property to FoodEstablishment #116
  • Bug Fixed: On/Off buttons inside modify schema are not changing its state on post save #138
  • Bug Fixed: Yoast compatibility checkbox is not active when yoast premium plugin is activated #138
Download this release

Release Info

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

Code changes from version 1.0.8.1 to 1.0.9

admin_section/css/main-style.css CHANGED
@@ -451,7 +451,7 @@ Compatibility tab css starts here
451
  width: 75%;
452
  padding-bottom: 10px;
453
  }
454
- .saswp-schem-type-note{
455
  color: chocolate;
456
  }
457
  .saswp-custom-fields-name{
451
  width: 75%;
452
  padding-bottom: 10px;
453
  }
454
+ .saswp-schem-type-note, .saswp-job-posting-note{
455
  color: chocolate;
456
  }
457
  .saswp-custom-fields-name{
admin_section/css/saswp-add-new.css CHANGED
@@ -2434,6 +2434,6 @@ body .amp_install_center {text-align: center}
2434
  .saswp_hide{
2435
  display: none;
2436
  }
2437
- .saswp-schem-type-note{
2438
  color: chocolate;
2439
  }
2434
  .saswp_hide{
2435
  display: none;
2436
  }
2437
+ .saswp-schem-type-note, .saswp-job-posting-note{
2438
  color: chocolate;
2439
  }
admin_section/js/main-script.js CHANGED
@@ -62,6 +62,14 @@ jQuery(document).ready(function($){
62
  if(schematype == 'qanda'){
63
  $(".saswp-schem-type-note").removeClass('saswp_hide');
64
  }
 
 
 
 
 
 
 
 
65
  saswp_enable_rating_review();
66
  });
67
 
@@ -234,9 +242,11 @@ jQuery(document).ready(function($){
234
  case 'saswp_archive_schema_checkbox':
235
 
236
  if ($(this).is(':checked')) {
237
- $("#saswp_archive_schema").val(1);
 
238
  }else{
239
  $("#saswp_archive_schema").val(0);
 
240
  }
241
  break;
242
  case 'saswp_breadcrumb_schema_checkbox':
@@ -248,6 +258,15 @@ jQuery(document).ready(function($){
248
  }
249
  break;
250
 
 
 
 
 
 
 
 
 
 
251
  case 'saswp_comments_schema_checkbox':
252
 
253
  if ($(this).is(':checked')) {
@@ -310,6 +329,15 @@ jQuery(document).ready(function($){
310
  }
311
  break;
312
 
 
 
 
 
 
 
 
 
 
313
  case 'saswp-yoast-checkbox':
314
 
315
  if ($(this).is(':checked')) {
@@ -766,7 +794,7 @@ jQuery(document).ready(function($){
766
  });
767
  saswpCustomSelect2();
768
  function saswpCustomSelect2(){
769
- if(saswp_app_object.post_type == 'saswp' || saswp_app_object.page_now =='saswp'){
770
 
771
  $('.saswp-custom-fields-select2').select2({
772
  ajax: {
62
  if(schematype == 'qanda'){
63
  $(".saswp-schem-type-note").removeClass('saswp_hide');
64
  }
65
+
66
+ $(".saswp-job-posting-note").addClass('saswp_hide');
67
+
68
+
69
+ // if(schematype == 'JobPosting'){
70
+ // $(".saswp-job-posting-note").removeClass('saswp_hide');
71
+ // }
72
+
73
  saswp_enable_rating_review();
74
  });
75
 
242
  case 'saswp_archive_schema_checkbox':
243
 
244
  if ($(this).is(':checked')) {
245
+ $("#saswp_archive_schema").val(1);
246
+ $(".saswp_archive_schema_type_class").parent().parent().show();
247
  }else{
248
  $("#saswp_archive_schema").val(0);
249
+ $(".saswp_archive_schema_type_class").parent().parent().hide();
250
  }
251
  break;
252
  case 'saswp_breadcrumb_schema_checkbox':
258
  }
259
  break;
260
 
261
+ case 'saswp_site_navigation_menu_checkbox':
262
+
263
+ if ($(this).is(':checked')) {
264
+ $("#saswp_site_navigation_menu").val(1);
265
+ }else{
266
+ $("#saswp_site_navigation_menu").val(0);
267
+ }
268
+ break;
269
+
270
  case 'saswp_comments_schema_checkbox':
271
 
272
  if ($(this).is(':checked')) {
329
  }
330
  break;
331
 
332
+ case 'saswp-wp-job-manager-checkbox':
333
+
334
+ if ($(this).is(':checked')) {
335
+ $("#saswp-wp-job-manager").val(1);
336
+ }else{
337
+ $("#saswp-wp-job-manager").val(0);
338
+ }
339
+ break;
340
+
341
  case 'saswp-yoast-checkbox':
342
 
343
  if ($(this).is(':checked')) {
794
  });
795
  saswpCustomSelect2();
796
  function saswpCustomSelect2(){
797
+ if((saswp_app_object.post_type == 'saswp' || saswp_app_object.page_now =='saswp') && saswp_app_object.page_now !='saswp_page_structured_data_options'){
798
 
799
  $('.saswp-custom-fields-select2').select2({
800
  ajax: {
admin_section/js/saswp-add-new.js CHANGED
@@ -285,6 +285,13 @@ jQuery(document).ready(function($) {
285
  if(schematype == 'qanda'){
286
  $(".saswp-schem-type-note").removeClass('saswp_hide');
287
  }
 
 
 
 
 
 
 
288
  saswp_enable_rating_review();
289
  }).change();
290
 
285
  if(schematype == 'qanda'){
286
  $(".saswp-schem-type-note").removeClass('saswp_hide');
287
  }
288
+
289
+ $(".saswp-job-posting-note").addClass('saswp_hide');
290
+
291
+ // if(schematype == 'JobPosting'){
292
+ // $(".saswp-job-posting-note").removeClass('saswp_hide');
293
+ // }
294
+
295
  saswp_enable_rating_review();
296
  }).change();
297
 
admin_section/newsletter.php CHANGED
@@ -13,10 +13,13 @@
13
  add_action('admin_head', array($this, 'saswp_admin_head')); // Hook to admin head
14
  }
15
  }
16
- function saswp_admin_head () {
 
17
  ?>
18
  <style type="text/css" media="screen"> #pointer-primary { margin: 0 5px 0 0; } </style>
19
- <?php }
 
 
20
  function saswp_admin_print_footer_scripts () {
21
 
22
  global $pagenow;
13
  add_action('admin_head', array($this, 'saswp_admin_head')); // Hook to admin head
14
  }
15
  }
16
+ function saswp_admin_head () {
17
+
18
  ?>
19
  <style type="text/css" media="screen"> #pointer-primary { margin: 0 5px 0 0; } </style>
20
+ <?php
21
+
22
+ }
23
  function saswp_admin_print_footer_scripts () {
24
 
25
  global $pagenow;
admin_section/settings.php CHANGED
@@ -365,6 +365,19 @@ function saswp_general_page_callback(){
365
  'name' => 'sd_data[saswp_archive_schema]',
366
  )
367
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
368
  array(
369
  'label' => 'BreadCrumbs',
370
  'id' => 'saswp_breadcrumb_schema_checkbox',
@@ -386,7 +399,19 @@ function saswp_general_page_callback(){
386
  'id' => 'saswp_comments_schema',
387
  'name' => 'sd_data[saswp_comments_schema]',
388
  )
 
 
 
 
 
 
 
 
 
 
 
389
  )
 
390
  )
391
 
392
  ?>
@@ -557,7 +582,7 @@ function saswp_knowledge_page_callback(){
557
  'name' => 'sd_data[sd_logo][url]',
558
  'class' => 'saswp-icon upload large-text',
559
  'type' => 'media',
560
- 'note' => 'According to google validation tool, Logo size must be 160*50',
561
  'attributes' => array(
562
  'readonly' => 'readonly'
563
  )
@@ -899,62 +924,75 @@ function saswp_compatibility_page_callback(){
899
 
900
  $settings = saswp_defaultSettings();
901
  $kk_star = array(
902
- 'label' => 'kk Star Ratings',
903
- 'id' => 'saswp-kk-star-raring-checkbox',
904
- 'name' => 'saswp-kk-star-raring-checkbox',
905
- 'type' => 'checkbox',
906
- 'class' => 'checkbox saswp-checkbox',
907
  'hidden' => array(
908
- 'id' => 'saswp-kk-star-raring',
909
- 'name' => 'sd_data[saswp-kk-star-raring]',
910
  )
911
  );
912
  $woocommerce = array(
913
- 'label' => 'Woocommerce',
914
- 'id' => 'saswp-woocommerce-checkbox',
915
- 'name' => 'saswp-woocommerce-checkbox',
916
- 'type' => 'checkbox',
917
- 'class' => 'checkbox saswp-checkbox',
918
  'hidden' => array(
919
- 'id' => 'saswp-woocommerce',
920
- 'name' => 'sd_data[saswp-woocommerce]',
921
  )
922
  );
923
  $extratheme = array(
924
- 'label' => 'Extra Theme By Elegant',
925
- 'id' => 'saswp-extra-checkbox',
926
- 'name' => 'saswp-extra-checkbox',
927
- 'type' => 'checkbox',
928
- 'class' => 'checkbox saswp-checkbox',
929
  'hidden' => array(
930
- 'id' => 'saswp-extra',
931
- 'name' => 'sd_data[saswp-extra]',
932
  )
933
  );
934
  $dwquestiton = array(
935
- 'label' => 'DW Question Answer',
936
- 'id' => 'saswp-dw-question-answer-checkbox',
937
- 'name' => 'saswp-dw-question-answer-checkbox',
938
- 'type' => 'checkbox',
939
- 'class' => 'checkbox saswp-checkbox',
940
  'hidden' => array(
941
- 'id' => 'saswp-dw-question-answer',
942
- 'name' => 'sd_data[saswp-dw-question-answer]',
 
 
 
 
 
 
 
 
 
 
 
 
943
  )
944
  );
 
945
  $yoast = array(
946
- 'label' => 'Yoast SEO Plugin',
947
- 'id' => 'saswp-yoast-checkbox',
948
- 'name' => 'saswp-yoast-checkbox',
949
- 'type' => 'checkbox',
950
- 'class' => 'checkbox saswp-checkbox',
951
- 'hidden' => array(
952
- 'id' => 'saswp-yoast',
953
- 'name' => 'sd_data[saswp-yoast]',
954
  )
955
  );
956
 
957
- if(!is_plugin_active('wordpress-seo/wp-seo.php')){
958
  $yoast['attributes'] = array(
959
  'disabled' => 'disabled'
960
  );
@@ -999,6 +1037,15 @@ function saswp_compatibility_page_callback(){
999
  $dwquestiton['note'] = esc_html__('Plugin is not activated','schema-and-structured-data-for-wp');
1000
  $settings['saswp-dw-question-answer'] = 0;
1001
  }
 
 
 
 
 
 
 
 
 
1002
 
1003
  $field_objs = new saswp_fields_generator();
1004
  $meta_fields = array(
@@ -1006,6 +1053,7 @@ function saswp_compatibility_page_callback(){
1006
  $woocommerce,
1007
  $extratheme,
1008
  $dwquestiton,
 
1009
  $yoast
1010
 
1011
  );
365
  'name' => 'sd_data[saswp_archive_schema]',
366
  )
367
  ),
368
+ array(
369
+ 'label' => 'Schema Type',
370
+ 'id' => 'saswp_archive_schema_type',
371
+ 'name' => 'sd_data[saswp_archive_schema_type]',
372
+ 'class' => 'saswp_archive_schema_type_class',
373
+ 'type' => 'select',
374
+ 'options' => array(
375
+ 'Article' => 'Article',
376
+ 'Blogposting' => 'Blogposting',
377
+ 'NewsArticle' => 'NewsArticle',
378
+ 'WebPage' => 'WebPage'
379
+ )
380
+ ),
381
  array(
382
  'label' => 'BreadCrumbs',
383
  'id' => 'saswp_breadcrumb_schema_checkbox',
399
  'id' => 'saswp_comments_schema',
400
  'name' => 'sd_data[saswp_comments_schema]',
401
  )
402
+ ),
403
+ array(
404
+ 'label' => 'Site Navigation Menu',
405
+ 'id' => 'saswp_site_navigation_menu_checkbox',
406
+ 'name' => 'saswp_site_navigation_menu_checkbox',
407
+ 'type' => 'checkbox',
408
+ 'class' => 'checkbox saswp-checkbox',
409
+ 'hidden' => array(
410
+ 'id' => 'saswp_site_navigation_menu',
411
+ 'name' => 'sd_data[saswp_site_navigation_menu]',
412
+ )
413
  )
414
+
415
  )
416
 
417
  ?>
582
  'name' => 'sd_data[sd_logo][url]',
583
  'class' => 'saswp-icon upload large-text',
584
  'type' => 'media',
585
+ 'note' => 'According to google validation tool, Logo size must be 160*50 or 600*60',
586
  'attributes' => array(
587
  'readonly' => 'readonly'
588
  )
924
 
925
  $settings = saswp_defaultSettings();
926
  $kk_star = array(
927
+ 'label' => 'kk Star Ratings',
928
+ 'id' => 'saswp-kk-star-raring-checkbox',
929
+ 'name' => 'saswp-kk-star-raring-checkbox',
930
+ 'type' => 'checkbox',
931
+ 'class' => 'checkbox saswp-checkbox',
932
  'hidden' => array(
933
+ 'id' => 'saswp-kk-star-raring',
934
+ 'name' => 'sd_data[saswp-kk-star-raring]',
935
  )
936
  );
937
  $woocommerce = array(
938
+ 'label' => 'Woocommerce',
939
+ 'id' => 'saswp-woocommerce-checkbox',
940
+ 'name' => 'saswp-woocommerce-checkbox',
941
+ 'type' => 'checkbox',
942
+ 'class' => 'checkbox saswp-checkbox',
943
  'hidden' => array(
944
+ 'id' => 'saswp-woocommerce',
945
+ 'name' => 'sd_data[saswp-woocommerce]',
946
  )
947
  );
948
  $extratheme = array(
949
+ 'label' => 'Extra Theme By Elegant',
950
+ 'id' => 'saswp-extra-checkbox',
951
+ 'name' => 'saswp-extra-checkbox',
952
+ 'type' => 'checkbox',
953
+ 'class' => 'checkbox saswp-checkbox',
954
  'hidden' => array(
955
+ 'id' => 'saswp-extra',
956
+ 'name' => 'sd_data[saswp-extra]',
957
  )
958
  );
959
  $dwquestiton = array(
960
+ 'label' => 'DW Question Answer',
961
+ 'id' => 'saswp-dw-question-answer-checkbox',
962
+ 'name' => 'saswp-dw-question-answer-checkbox',
963
+ 'type' => 'checkbox',
964
+ 'class' => 'checkbox saswp-checkbox',
965
  'hidden' => array(
966
+ 'id' => 'saswp-dw-question-answer',
967
+ 'name' => 'sd_data[saswp-dw-question-answer]',
968
+ )
969
+ );
970
+
971
+ $wpjobmanager = array(
972
+ 'label' => 'WP Job Manager',
973
+ 'id' => 'saswp-wp-job-manager-checkbox',
974
+ 'name' => 'saswp-wp-job-manager-checkbox',
975
+ 'type' => 'checkbox',
976
+ 'class' => 'checkbox saswp-checkbox',
977
+ 'hidden' => array(
978
+ 'id' => 'saswp-wp-job-manager',
979
+ 'name' => 'sd_data[saswp-wp-job-manager]',
980
  )
981
  );
982
+
983
  $yoast = array(
984
+ 'label' => 'Yoast SEO Plugin',
985
+ 'id' => 'saswp-yoast-checkbox',
986
+ 'name' => 'saswp-yoast-checkbox',
987
+ 'type' => 'checkbox',
988
+ 'class' => 'checkbox saswp-checkbox',
989
+ 'hidden' => array(
990
+ 'id' => 'saswp-yoast',
991
+ 'name' => 'sd_data[saswp-yoast]',
992
  )
993
  );
994
 
995
+ if(!is_plugin_active('wordpress-seo/wp-seo.php') && !is_plugin_active('wordpress-seo-premium/wp-seo-premium.php')){
996
  $yoast['attributes'] = array(
997
  'disabled' => 'disabled'
998
  );
1037
  $dwquestiton['note'] = esc_html__('Plugin is not activated','schema-and-structured-data-for-wp');
1038
  $settings['saswp-dw-question-answer'] = 0;
1039
  }
1040
+
1041
+ if(!is_plugin_active('wp-job-manager/wp-job-manager.php')){
1042
+
1043
+ $wpjobmanager['attributes'] = array(
1044
+ 'disabled' => 'disabled'
1045
+ );
1046
+ $wpjobmanager['note'] = esc_html__('Plugin is not activated','schema-and-structured-data-for-wp');
1047
+ $settings['saswp-wp-job-manager'] = 0;
1048
+ }
1049
 
1050
  $field_objs = new saswp_fields_generator();
1051
  $meta_fields = array(
1053
  $woocommerce,
1054
  $extratheme,
1055
  $dwquestiton,
1056
+ $wpjobmanager,
1057
  $yoast
1058
 
1059
  );
admin_section/structure_admin.php CHANGED
@@ -1,30 +1,49 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /*
3
  * Storing and updating all ads post ids in transient on different actions
4
  * which we will fetch all ids from here to display our post
5
  */
6
  function saswp_published(){
7
 
8
- $all_schema_post = get_posts(
9
- array(
10
- 'post_type' => 'saswp',
11
- 'posts_per_page' => -1,
12
- 'post_status' => 'publish',
13
- )
14
- );
15
-
16
- $schema_post_ids = array();
17
 
18
- foreach($all_schema_post as $val){
19
 
20
- $schema_post_ids[] = $val->ID;
 
21
 
22
  }
23
 
24
- $schema_id_json = json_encode($schema_post_ids);
25
- set_transient('saswp_transient_schema_ids', $schema_id_json);
26
 
27
  }
 
28
  function saswp_update_ids_on_trash(){
29
 
30
  delete_transient('saswp_transient_schema_ids');
@@ -86,6 +105,11 @@ function saswp_get_all_schema_posts(){
86
 
87
  $schema_id_array = json_decode(get_transient('saswp_transient_schema_ids'), true);
88
 
 
 
 
 
 
89
  if($schema_id_array){
90
 
91
  if(count($schema_id_array)>0){
@@ -654,7 +678,13 @@ add_action( 'wp_print_scripts', 'saswp_dequeue_script', 100 );
654
  $post_found_status ='';
655
 
656
  $saswp_posts = json_decode(get_transient('saswp_transient_schema_ids'), true);
657
-
 
 
 
 
 
 
658
  if(empty($saswp_posts)){
659
 
660
  $post_found_status ='not_found';
@@ -1186,4 +1216,3 @@ function saswp_feeback_remindme(){
1186
  }
1187
 
1188
  add_action('wp_ajax_saswp_feeback_remindme', 'saswp_feeback_remindme');
1189
-
1
  <?php
2
+
3
+ function saswp_get_saved_schema_ids(){
4
+
5
+ $schema_ids = array();
6
+
7
+ $all_schemas = get_posts(
8
+ array(
9
+ 'post_type' => 'saswp',
10
+ 'posts_per_page' => -1,
11
+ 'post_status' => 'publish',
12
+ )
13
+ );
14
+
15
+ if($all_schemas){
16
+
17
+ foreach($all_schemas as $schema){
18
+
19
+ $schema_ids[] = $schema->ID;
20
+
21
+ }
22
+
23
+ }
24
+
25
+ return $schema_ids;
26
+
27
+ }
28
+
29
  /*
30
  * Storing and updating all ads post ids in transient on different actions
31
  * which we will fetch all ids from here to display our post
32
  */
33
  function saswp_published(){
34
 
35
+ $schema_post_ids = saswp_get_saved_schema_ids();
 
 
 
 
 
 
 
 
36
 
37
+ if($schema_post_ids){
38
 
39
+ $schema_id_json = json_encode($schema_post_ids);
40
+ set_transient('saswp_transient_schema_ids', $schema_id_json);
41
 
42
  }
43
 
 
 
44
 
45
  }
46
+
47
  function saswp_update_ids_on_trash(){
48
 
49
  delete_transient('saswp_transient_schema_ids');
105
 
106
  $schema_id_array = json_decode(get_transient('saswp_transient_schema_ids'), true);
107
 
108
+ if(!$schema_id_array){
109
+
110
+ $schema_id_array = saswp_get_saved_schema_ids();
111
+
112
+ }
113
  if($schema_id_array){
114
 
115
  if(count($schema_id_array)>0){
678
  $post_found_status ='';
679
 
680
  $saswp_posts = json_decode(get_transient('saswp_transient_schema_ids'), true);
681
+
682
+ if(!$saswp_posts){
683
+
684
+ $saswp_posts = saswp_get_saved_schema_ids();
685
+
686
+ }
687
+
688
  if(empty($saswp_posts)){
689
 
690
  $post_found_status ='not_found';
1216
  }
1217
 
1218
  add_action('wp_ajax_saswp_feeback_remindme', 'saswp_feeback_remindme');
 
output/function.php CHANGED
@@ -19,9 +19,12 @@ function saswp_data_generator() {
19
  $post_specific_enable = '';
20
  $kb_website_output = '';
21
  $kb_schema_output = '';
22
- $contact_page_output = saswp_contact_page_output();
23
- $about_page_output = saswp_about_page_output();
24
 
 
 
 
25
  $author_output = saswp_author_output();
26
  $archive_output = saswp_archive_output();
27
 
@@ -31,6 +34,7 @@ function saswp_data_generator() {
31
 
32
  $kb_website_output = saswp_kb_website_output();
33
  $kb_schema_output = saswp_kb_schema_output();
 
34
  }
35
 
36
  if(is_singular()){
@@ -87,7 +91,16 @@ function saswp_data_generator() {
87
  $output .= $kb_website_output;
88
  $output .= ",";
89
  $output .= "\n\n";
90
- }
 
 
 
 
 
 
 
 
 
91
  if(!empty($schema_breadcrumb_output)){
92
 
93
  $output .= $schema_breadcrumb_output;
19
  $post_specific_enable = '';
20
  $kb_website_output = '';
21
  $kb_schema_output = '';
22
+ $site_navigation = '';
23
+
24
 
25
+ $site_navigation = saswp_site_navigation_output();
26
+ $contact_page_output = saswp_contact_page_output();
27
+ $about_page_output = saswp_about_page_output();
28
  $author_output = saswp_author_output();
29
  $archive_output = saswp_archive_output();
30
 
34
 
35
  $kb_website_output = saswp_kb_website_output();
36
  $kb_schema_output = saswp_kb_schema_output();
37
+
38
  }
39
 
40
  if(is_singular()){
91
  $output .= $kb_website_output;
92
  $output .= ",";
93
  $output .= "\n\n";
94
+ }
95
+ if(!empty($site_navigation)){
96
+
97
+ $site_navigation = json_encode($site_navigation);
98
+
99
+ $output .= $site_navigation;
100
+ $output .= ",";
101
+ $output .= "\n\n";
102
+
103
+ }
104
  if(!empty($schema_breadcrumb_output)){
105
 
106
  $output .= $schema_breadcrumb_output;
output/output.php CHANGED
@@ -67,7 +67,6 @@ function saswp_kb_schema_output() {
67
 
68
  // Organization Schema
69
 
70
-
71
  if ( saswp_remove_warnings($sd_data, 'saswp_kb_type', 'saswp_string') == 'Organization' ) {
72
 
73
  $logo = '';
@@ -106,11 +105,11 @@ function saswp_kb_schema_output() {
106
  );
107
 
108
  $input = array(
109
- '@context' =>'http://schema.org',
110
- '@type' => $sd_data['saswp_kb_type'],
111
- 'name' => saswp_remove_warnings($sd_data, 'sd_name', 'saswp_string'),
112
- 'url' => saswp_remove_warnings($sd_data, 'sd_url', 'saswp_string'),
113
- 'sameAs' => $platform,
114
  );
115
 
116
  if($logo !='' && $width !='' && $height !=''){
@@ -137,9 +136,9 @@ function saswp_kb_schema_output() {
137
  $width = '';
138
 
139
  if(isset($sd_data['sd-person-image'])){
140
- $image = $sd_data['sd-person-image']['url'];
141
  $height = $sd_data['sd-person-image']['height'];
142
- $width = $sd_data['sd-person-image']['width'];
143
  }
144
 
145
  if( '' == $image && empty($image) && isset($sd_data['sd_default_image'])){
@@ -159,12 +158,12 @@ function saswp_kb_schema_output() {
159
  '@type' => $sd_data['saswp_kb_type'],
160
  'name' => $sd_data['sd-person-name'],
161
  'url' => $sd_data['sd-person-url'],
162
- 'image' => array(
163
- '@type' => 'ImageObject',
164
- 'url' => $image,
165
- 'width' => $width,
166
- 'height' => $height,
167
- ),
168
  'telephone' => $sd_data['sd-person-phone-number'],
169
  );
170
  }
@@ -174,7 +173,9 @@ function saswp_kb_schema_output() {
174
  }
175
 
176
  function sd_is_blog() {
 
177
  return ( is_author() || is_category() || is_tag() || is_date() || is_home() || is_single() ) && 'post' == get_post_type();
 
178
  }
179
 
180
  function saswp_schema_output() {
@@ -232,7 +233,7 @@ function saswp_schema_output() {
232
 
233
  $aggregateRating = array();
234
  $kkstar_aggregateRating = array();
235
- $saswp_over_all_rating ='';
236
 
237
  if(isset($saswp_review_details['saswp-review-item-over-all'])){
238
 
@@ -478,7 +479,19 @@ function saswp_schema_output() {
478
  $service = new saswp_output_service();
479
  $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
480
  }
481
- }
 
 
 
 
 
 
 
 
 
 
 
 
482
 
483
  if( 'Product' === $schema_type){
484
 
@@ -851,6 +864,11 @@ function saswp_schema_output() {
851
 
852
  $input1['itemReviewed']['servesCuisine'] = $schema_data['saswp_review_schema_servescuisine'];
853
 
 
 
 
 
 
854
  }
855
 
856
  if(isset($schema_data['saswp_review_schema_itemreviewed_sameas'])){
@@ -1065,17 +1083,6 @@ function saswp_schema_output() {
1065
  $dayoftheweek = get_post_meta($schema_post_id, 'saswp_dayofweek', true);
1066
  $dayoftheweek = explode( "\r\n", $dayoftheweek);
1067
 
1068
- if(empty($image_details[0]) || $image_details[0] === NULL ){
1069
- $image_details[0] = $logo;
1070
- }
1071
- if(isset($business_details['local_business_logo'])){
1072
-
1073
- unset($image_details);
1074
- $image_details[0] = isset($business_details['local_business_logo']) ? $business_details['local_business_logo']['url']:'';
1075
- $image_details[1] = isset($business_details['local_business_logo']) ? $business_details['local_business_logo']['width']:'';
1076
- $image_details[2] = isset($business_details['local_business_logo']) ? $business_details['local_business_logo']['height']:'';
1077
-
1078
- }
1079
  if($business_name){
1080
 
1081
  $local_business = $business_name;
@@ -1091,7 +1098,13 @@ function saswp_schema_output() {
1091
  '@type' => $local_business ,
1092
  'name' => saswp_remove_warnings($business_details, 'local_business_name', 'saswp_string'),
1093
  'url' => get_permalink(),
1094
- 'description' => strip_tags(get_the_excerpt()),
 
 
 
 
 
 
1095
  'address' => array(
1096
  "@type" => "PostalAddress",
1097
  "streetAddress" => saswp_remove_warnings($business_details, 'local_street_address', 'saswp_string'),
@@ -1109,8 +1122,12 @@ function saswp_schema_output() {
1109
  }
1110
 
1111
 
1112
- if(isset($business_details['local_enable_rating'])){
1113
-
 
 
 
 
1114
  $input1['aggregateRating'] = array(
1115
  "@type" => "AggregateRating",
1116
  "ratingValue" => saswp_remove_warnings($business_details, 'local_rating', 'saswp_string'),
@@ -1141,7 +1158,7 @@ function saswp_schema_output() {
1141
  }
1142
 
1143
  if(isset($business_details['local_menu'])){
1144
- $input1['menu'] = $business_details['local_menu'];
1145
  }
1146
  }
1147
 
@@ -1223,7 +1240,14 @@ function saswp_post_specific_schema_output() {
1223
 
1224
 
1225
  $all_schema_output = array();
1226
- $all_schemas = json_decode(get_transient('saswp_transient_schema_ids'), true);
 
 
 
 
 
 
 
1227
  $schema_enable = get_post_meta($post->ID, 'saswp_enable_disable_schema', true);
1228
 
1229
  if($all_schemas){
@@ -1897,6 +1921,12 @@ function saswp_post_specific_schema_output() {
1897
 
1898
  }
1899
 
 
 
 
 
 
 
1900
  if(isset($all_post_meta['saswp_review_schema_itemreviewed_sameas_'.$schema_id])){
1901
 
1902
  $input1['itemReviewed']['sameAs'] = $all_post_meta['saswp_review_schema_itemreviewed_sameas_'.$schema_id][0];
@@ -1915,17 +1945,17 @@ function saswp_post_specific_schema_output() {
1915
 
1916
  }
1917
 
 
1918
 
1919
- if(isset($all_post_meta['saswp_review_schema_image_'.$schema_id])){
1920
-
1921
  $input1['itemReviewed']['image']['@type'] = 'ImageObject';
1922
- $input1['itemReviewed']['image']['url'] = $all_post_meta['saswp_review_schema_image_'.$schema_id];
1923
- $input1['itemReviewed']['image']['width'] = $all_post_meta['saswp_review_schema_image_detail_'.$schema_id]['width'];
1924
- $input1['itemReviewed']['image']['height']= $all_post_meta['saswp_review_schema_image_detail_'.$schema_id]['height'];
1925
 
1926
  }
1927
-
1928
-
1929
  if(saswp_remove_warnings($all_post_meta, 'saswp_review_schema_street_address_'.$schema_id, 'saswp_array') !='' || saswp_remove_warnings($all_post_meta, 'saswp_review_schema_locality_'.$schema_id, 'saswp_array') !=''){
1930
 
1931
 
@@ -1968,6 +1998,7 @@ function saswp_post_specific_schema_output() {
1968
  $input1['itemReviewed']['author']['@type'] = 'Person';
1969
  $input1['itemReviewed']['author']['name'] = $review_author;
1970
  $input1['itemReviewed']['author']['sameAs'] = $all_post_meta['saswp_review_schema_author_sameas_'.$schema_id][0];
 
1971
  }
1972
 
1973
  break;
@@ -2039,25 +2070,43 @@ function saswp_post_specific_schema_output() {
2039
  }
2040
 
2041
  if( 'local_business' === $schema_type){
2042
- $operation_days = explode( "rn", esc_html( stripslashes(saswp_remove_warnings($all_post_meta, 'saswp_dayofweek_'.$schema_id, 'saswp_array'))) );;
2043
- $business_sub_name ='';
2044
- $business_type = saswp_remove_warnings($all_post_meta, 'saswp_business_type_'.$schema_id, 'saswp_array');
2045
- $post_specific_obj = new saswp_post_specific();
 
2046
  $check_business_type = $post_specific_obj->saswp_get_sub_business_array($business_type);
 
2047
  if(!empty($check_business_type)){
 
2048
  $business_sub_name = saswp_remove_warnings($all_post_meta, 'saswp_business_name_'.$schema_id, 'saswp_array');
2049
- }
 
 
2050
  if($business_sub_name){
2051
- $local_business = $business_sub_name;
 
 
2052
  }else{
 
2053
  $local_business = $business_type;
2054
- }
 
 
 
 
2055
  $input1 = array(
2056
  '@context' => 'http://schema.org',
2057
  '@type' => $local_business ,
2058
  'name' => saswp_remove_warnings($all_post_meta, 'local_business_name_'.$schema_id, 'saswp_array'),
2059
  'url' => saswp_remove_warnings($all_post_meta, 'local_business_name_url_'.$schema_id, 'saswp_array'),
2060
  'description' => saswp_remove_warnings($all_post_meta, 'local_business_description_'.$schema_id, 'saswp_array'),
 
 
 
 
 
 
2061
  'address' => array(
2062
  "@type" => "PostalAddress",
2063
  "streetAddress" => saswp_remove_warnings($all_post_meta, 'local_street_address_'.$schema_id, 'saswp_array'),
@@ -2081,7 +2130,7 @@ function saswp_post_specific_schema_output() {
2081
  }
2082
 
2083
  if(!empty($aggregateRating)){
2084
- $input1['aggregateRating'] = $aggregateRating;
2085
  }
2086
  if(!empty($kkstar_aggregateRating)){
2087
  $input1['aggregateRating'] = $kkstar_aggregateRating;
@@ -2090,7 +2139,7 @@ function saswp_post_specific_schema_output() {
2090
  $input1 = array_merge($input1, $extra_theme_review);
2091
  }
2092
  if(isset($all_post_meta['local_price_range_'.$schema_id][0])){
2093
- $input1['priceRange'] = $all_post_meta['local_price_range_'.$schema_id][0];
2094
  }
2095
 
2096
  if(isset($all_post_meta['local_accepts_reservations_'.$schema_id][0])){
@@ -2098,11 +2147,11 @@ function saswp_post_specific_schema_output() {
2098
  }
2099
 
2100
  if(isset($all_post_meta['local_serves_cuisine_'.$schema_id][0])){
2101
- $input1['servesCuisine'] = $all_post_meta['local_price_serves_cuisine_'.$schema_id][0];
2102
  }
2103
 
2104
  if(isset($all_post_meta['local_menu_'.$schema_id][0])){
2105
- $input1['menu'] = $all_post_meta['local_menu_'.$schema_id][0];
2106
  }
2107
  }
2108
 
@@ -2258,7 +2307,8 @@ function saswp_kb_website_output(){
2258
  // For Archive
2259
  function saswp_archive_output(){
2260
 
2261
- global $query_string, $sd_data;
 
2262
  $site_name ='';
2263
 
2264
  if(isset($sd_data['sd_name']) && $sd_data['sd_name'] !=''){
@@ -2269,17 +2319,42 @@ function saswp_archive_output(){
2269
 
2270
  if(isset($sd_data['saswp_archive_schema']) && $sd_data['saswp_archive_schema'] == 1){
2271
 
 
 
2272
  $service_object = new saswp_output_service();
2273
  $logo = $service_object->saswp_get_publisher(true);
2274
 
2275
 
2276
  if ( is_category() ) {
 
2277
  $category_posts = array();
2278
  $category_loop = new WP_Query( $query_string );
2279
  if ( $category_loop->have_posts() ):
2280
  while( $category_loop->have_posts() ): $category_loop->the_post();
2281
  $image_id = get_post_thumbnail_id();
2282
- $image_details = wp_get_attachment_image_src($image_id, 'full');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2283
  $publisher_info = array(
2284
  "type" => "Organization",
2285
  "name" => $site_name,
@@ -2296,7 +2371,7 @@ function saswp_archive_output(){
2296
 
2297
  $category_posts[] = array(
2298
 
2299
- '@type' => 'BlogPosting',
2300
  'headline' => get_the_title(),
2301
  'url' => get_the_permalink(),
2302
  'datePublished' => get_the_date('c'),
@@ -2304,7 +2379,7 @@ function saswp_archive_output(){
2304
  'mainEntityOfPage' => get_the_permalink(),
2305
  'author' => get_the_author(),
2306
  'publisher' => $publisher_info,
2307
- 'image' => $image_details[0],
2308
  );
2309
 
2310
  endwhile;
@@ -2332,13 +2407,26 @@ function saswp_archive_output(){
2332
  }
2333
  }
2334
 
2335
- // For Author
 
 
 
 
 
2336
  function saswp_author_output()
2337
  {
2338
- global $post, $sd_data;
 
 
2339
  if(isset($sd_data['saswp_archive_schema']) && $sd_data['saswp_archive_schema'] == 1){
2340
- $post_id = $post->ID;
2341
- if(is_author()){
 
 
 
 
 
 
2342
  // Get author from post content
2343
  $post_content = get_post($post_id);
2344
  $post_author = get_userdata($post_content->post_author);
@@ -2381,7 +2469,11 @@ function saswp_author_output()
2381
  }
2382
  }
2383
 
2384
- // For About Page
 
 
 
 
2385
  function saswp_about_page_output()
2386
  {
2387
  global $sd_data;
@@ -2420,7 +2512,81 @@ function saswp_about_page_output()
2420
  }
2421
 
2422
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2423
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2424
  // For Contact Page
2425
  function saswp_contact_page_output()
2426
  {
@@ -2477,22 +2643,22 @@ function saswp_get_comments($post_id){
2477
 
2478
  $post_comments = get_comments( array(
2479
  'post_id' => $post_id,
2480
- 'number' => $count,
2481
- 'status' => 'approve',
2482
- 'type' => 'comment'
2483
  )
2484
  );
2485
 
2486
  if ( count( $post_comments ) ) {
2487
  foreach ( $post_comments as $comment ) {
2488
  $comments[] = array (
2489
- '@type' => 'Comment',
2490
  'dateCreated' => $comment->comment_date,
2491
  'description' => $comment->comment_content,
2492
  'author' => array (
2493
  '@type' => 'Person',
2494
- 'name' => $comment->comment_author,
2495
- 'url' => $comment->comment_author_url,
2496
  ),
2497
  );
2498
  }
@@ -2502,10 +2668,15 @@ function saswp_get_comments($post_id){
2502
  }
2503
 
2504
  function saswp_get_schema_data($schema_id, $schema_key){
 
2505
  $details = array();
 
2506
  if($schema_id && $schema_key){
2507
- $details = esc_sql ( get_post_meta($schema_id, $schema_key, true));
 
 
2508
  }
 
2509
  return $details;
2510
  }
2511
 
@@ -2562,10 +2733,10 @@ function saswp_remove_warnings($data, $index, $type){
2562
 
2563
  if($type =='saswp_string'){
2564
 
2565
- if(isset($data[$index])){
2566
- return $data[$index];
2567
- }else{
2568
- return '';
2569
- }
2570
  }
2571
  }
67
 
68
  // Organization Schema
69
 
 
70
  if ( saswp_remove_warnings($sd_data, 'saswp_kb_type', 'saswp_string') == 'Organization' ) {
71
 
72
  $logo = '';
105
  );
106
 
107
  $input = array(
108
+ '@context' =>'http://schema.org',
109
+ '@type' => $sd_data['saswp_kb_type'],
110
+ 'name' => saswp_remove_warnings($sd_data, 'sd_name', 'saswp_string'),
111
+ 'url' => saswp_remove_warnings($sd_data, 'sd_url', 'saswp_string'),
112
+ 'sameAs' => $platform,
113
  );
114
 
115
  if($logo !='' && $width !='' && $height !=''){
136
  $width = '';
137
 
138
  if(isset($sd_data['sd-person-image'])){
139
+ $image = $sd_data['sd-person-image']['url'];
140
  $height = $sd_data['sd-person-image']['height'];
141
+ $width = $sd_data['sd-person-image']['width'];
142
  }
143
 
144
  if( '' == $image && empty($image) && isset($sd_data['sd_default_image'])){
158
  '@type' => $sd_data['saswp_kb_type'],
159
  'name' => $sd_data['sd-person-name'],
160
  'url' => $sd_data['sd-person-url'],
161
+ 'image' => array(
162
+ '@type' => 'ImageObject',
163
+ 'url' => $image,
164
+ 'width' => $width,
165
+ 'height' => $height,
166
+ ),
167
  'telephone' => $sd_data['sd-person-phone-number'],
168
  );
169
  }
173
  }
174
 
175
  function sd_is_blog() {
176
+
177
  return ( is_author() || is_category() || is_tag() || is_date() || is_home() || is_single() ) && 'post' == get_post_type();
178
+
179
  }
180
 
181
  function saswp_schema_output() {
233
 
234
  $aggregateRating = array();
235
  $kkstar_aggregateRating = array();
236
+ $saswp_over_all_rating = '';
237
 
238
  if(isset($saswp_review_details['saswp-review-item-over-all'])){
239
 
479
  $service = new saswp_output_service();
480
  $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
481
  }
482
+ }
483
+
484
+ // if( 'JobPosting' === $schema_type){
485
+ // global $post;
486
+ // $service_object = new saswp_output_service();
487
+ // $input1 = $service_object->saswp_wp_job_manager_details($post);
488
+ //
489
+ // if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
490
+ // $service = new saswp_output_service();
491
+ // $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
492
+ // }
493
+ // }
494
+
495
 
496
  if( 'Product' === $schema_type){
497
 
864
 
865
  $input1['itemReviewed']['servesCuisine'] = $schema_data['saswp_review_schema_servescuisine'];
866
 
867
+ }
868
+ if(isset($schema_data['saswp_review_schema_menu'])){
869
+
870
+ $input1['itemReviewed']['hasMenu'] = $schema_data['saswp_review_schema_menu'];
871
+
872
  }
873
 
874
  if(isset($schema_data['saswp_review_schema_itemreviewed_sameas'])){
1083
  $dayoftheweek = get_post_meta($schema_post_id, 'saswp_dayofweek', true);
1084
  $dayoftheweek = explode( "\r\n", $dayoftheweek);
1085
 
 
 
 
 
 
 
 
 
 
 
 
1086
  if($business_name){
1087
 
1088
  $local_business = $business_name;
1098
  '@type' => $local_business ,
1099
  'name' => saswp_remove_warnings($business_details, 'local_business_name', 'saswp_string'),
1100
  'url' => get_permalink(),
1101
+ 'description' => strip_tags(get_the_excerpt()),
1102
+ 'image' => array(
1103
+ '@type' => 'ImageObject',
1104
+ 'url' => isset($business_details['local_business_logo']) ? $business_details['local_business_logo']['url']:'',
1105
+ 'width' => isset($business_details['local_business_logo']) ? $business_details['local_business_logo']['width']:'',
1106
+ 'height' => isset($business_details['local_business_logo']) ? $business_details['local_business_logo']['height']:'',
1107
+ ),
1108
  'address' => array(
1109
  "@type" => "PostalAddress",
1110
  "streetAddress" => saswp_remove_warnings($business_details, 'local_street_address', 'saswp_string'),
1122
  }
1123
 
1124
 
1125
+ if(isset($business_details['local_enable_rating'])
1126
+ && saswp_remove_warnings($business_details, 'local_rating', 'saswp_string') !=''
1127
+ && saswp_remove_warnings($business_details, 'local_review_count', 'saswp_string') !=''
1128
+ ){
1129
+
1130
+
1131
  $input1['aggregateRating'] = array(
1132
  "@type" => "AggregateRating",
1133
  "ratingValue" => saswp_remove_warnings($business_details, 'local_rating', 'saswp_string'),
1158
  }
1159
 
1160
  if(isset($business_details['local_menu'])){
1161
+ $input1['hasMenu'] = $business_details['local_menu'];
1162
  }
1163
  }
1164
 
1240
 
1241
 
1242
  $all_schema_output = array();
1243
+ $all_schemas = json_decode(get_transient('saswp_transient_schema_ids'), true);
1244
+
1245
+ if(!$all_schemas){
1246
+
1247
+ $all_schemas = saswp_get_saved_schema_ids();
1248
+
1249
+ }
1250
+
1251
  $schema_enable = get_post_meta($post->ID, 'saswp_enable_disable_schema', true);
1252
 
1253
  if($all_schemas){
1921
 
1922
  }
1923
 
1924
+ if(isset($all_post_meta['saswp_review_schema_menu_'.$schema_id])){
1925
+
1926
+ $input1['itemReviewed']['hasMenu'] = $all_post_meta['saswp_review_schema_menu_'.$schema_id][0];
1927
+
1928
+ }
1929
+
1930
  if(isset($all_post_meta['saswp_review_schema_itemreviewed_sameas_'.$schema_id])){
1931
 
1932
  $input1['itemReviewed']['sameAs'] = $all_post_meta['saswp_review_schema_itemreviewed_sameas_'.$schema_id][0];
1945
 
1946
  }
1947
 
1948
+ $review_image = get_post_meta( get_the_ID(), 'saswp_review_schema_image_'.$schema_id.'_detail',true);
1949
 
1950
+ if(!empty($review_image)){
1951
+
1952
  $input1['itemReviewed']['image']['@type'] = 'ImageObject';
1953
+ $input1['itemReviewed']['image']['url'] = $review_image['thumbnail'];
1954
+ $input1['itemReviewed']['image']['width'] = $review_image['width'];
1955
+ $input1['itemReviewed']['image']['height']= $review_image['height'];
1956
 
1957
  }
1958
+
 
1959
  if(saswp_remove_warnings($all_post_meta, 'saswp_review_schema_street_address_'.$schema_id, 'saswp_array') !='' || saswp_remove_warnings($all_post_meta, 'saswp_review_schema_locality_'.$schema_id, 'saswp_array') !=''){
1960
 
1961
 
1998
  $input1['itemReviewed']['author']['@type'] = 'Person';
1999
  $input1['itemReviewed']['author']['name'] = $review_author;
2000
  $input1['itemReviewed']['author']['sameAs'] = $all_post_meta['saswp_review_schema_author_sameas_'.$schema_id][0];
2001
+
2002
  }
2003
 
2004
  break;
2070
  }
2071
 
2072
  if( 'local_business' === $schema_type){
2073
+
2074
+ $operation_days = explode( "rn", esc_html( stripslashes(saswp_remove_warnings($all_post_meta, 'saswp_dayofweek_'.$schema_id, 'saswp_array'))) );;
2075
+ $business_sub_name ='';
2076
+ $business_type = saswp_remove_warnings($all_post_meta, 'saswp_business_type_'.$schema_id, 'saswp_array');
2077
+ $post_specific_obj = new saswp_post_specific();
2078
  $check_business_type = $post_specific_obj->saswp_get_sub_business_array($business_type);
2079
+
2080
  if(!empty($check_business_type)){
2081
+
2082
  $business_sub_name = saswp_remove_warnings($all_post_meta, 'saswp_business_name_'.$schema_id, 'saswp_array');
2083
+
2084
+ }
2085
+
2086
  if($business_sub_name){
2087
+
2088
+ $local_business = $business_sub_name;
2089
+
2090
  }else{
2091
+
2092
  $local_business = $business_type;
2093
+
2094
+ }
2095
+
2096
+ $local_image = get_post_meta( get_the_ID(), 'local_business_logo_'.$schema_id.'_detail',true);
2097
+
2098
  $input1 = array(
2099
  '@context' => 'http://schema.org',
2100
  '@type' => $local_business ,
2101
  'name' => saswp_remove_warnings($all_post_meta, 'local_business_name_'.$schema_id, 'saswp_array'),
2102
  'url' => saswp_remove_warnings($all_post_meta, 'local_business_name_url_'.$schema_id, 'saswp_array'),
2103
  'description' => saswp_remove_warnings($all_post_meta, 'local_business_description_'.$schema_id, 'saswp_array'),
2104
+ 'image' => array(
2105
+ '@type' => 'ImageObject',
2106
+ 'url' => saswp_remove_warnings($local_image, 'thumbnail', 'saswp_string'),
2107
+ 'width' => saswp_remove_warnings($local_image, 'width', 'saswp_string'),
2108
+ 'height' => saswp_remove_warnings($local_image, 'height', 'saswp_string'),
2109
+ ),
2110
  'address' => array(
2111
  "@type" => "PostalAddress",
2112
  "streetAddress" => saswp_remove_warnings($all_post_meta, 'local_street_address_'.$schema_id, 'saswp_array'),
2130
  }
2131
 
2132
  if(!empty($aggregateRating)){
2133
+ $input1['aggregateRating'] = $aggregateRating;
2134
  }
2135
  if(!empty($kkstar_aggregateRating)){
2136
  $input1['aggregateRating'] = $kkstar_aggregateRating;
2139
  $input1 = array_merge($input1, $extra_theme_review);
2140
  }
2141
  if(isset($all_post_meta['local_price_range_'.$schema_id][0])){
2142
+ $input1['priceRange'] = $all_post_meta['local_price_range_'.$schema_id][0];
2143
  }
2144
 
2145
  if(isset($all_post_meta['local_accepts_reservations_'.$schema_id][0])){
2147
  }
2148
 
2149
  if(isset($all_post_meta['local_serves_cuisine_'.$schema_id][0])){
2150
+ $input1['servesCuisine'] = $all_post_meta['local_serves_cuisine_'.$schema_id][0];
2151
  }
2152
 
2153
  if(isset($all_post_meta['local_menu_'.$schema_id][0])){
2154
+ $input1['hasMenu'] = $all_post_meta['local_menu_'.$schema_id][0];
2155
  }
2156
  }
2157
 
2307
  // For Archive
2308
  function saswp_archive_output(){
2309
 
2310
+ global $query_string, $sd_data;
2311
+
2312
  $site_name ='';
2313
 
2314
  if(isset($sd_data['sd_name']) && $sd_data['sd_name'] !=''){
2319
 
2320
  if(isset($sd_data['saswp_archive_schema']) && $sd_data['saswp_archive_schema'] == 1){
2321
 
2322
+ $schema_type = $sd_data['saswp_archive_schema_type'];
2323
+
2324
  $service_object = new saswp_output_service();
2325
  $logo = $service_object->saswp_get_publisher(true);
2326
 
2327
 
2328
  if ( is_category() ) {
2329
+
2330
  $category_posts = array();
2331
  $category_loop = new WP_Query( $query_string );
2332
  if ( $category_loop->have_posts() ):
2333
  while( $category_loop->have_posts() ): $category_loop->the_post();
2334
  $image_id = get_post_thumbnail_id();
2335
+
2336
+ $archive_image = array();
2337
+ $image_details = wp_get_attachment_image_src($image_id, 'full');
2338
+ if(!empty($image_details)){
2339
+
2340
+ $archive_image['@type'] = 'ImageObject';
2341
+ $archive_image['url'] = $image_details[0];
2342
+ $archive_image['width'] = $image_details[1];
2343
+ $archive_image['height'] = $image_details[2];
2344
+
2345
+ }else{
2346
+
2347
+ if(isset($sd_data['sd_default_image'])){
2348
+
2349
+ $archive_image['@type'] = 'ImageObject';
2350
+ $archive_image['url'] = $sd_data['sd_default_image']['url'];
2351
+ $archive_image['width'] = $sd_data['sd_default_image_width'];
2352
+ $archive_image['height'] = $sd_data['sd_default_image_height'];
2353
+ }
2354
+
2355
+
2356
+ }
2357
+
2358
  $publisher_info = array(
2359
  "type" => "Organization",
2360
  "name" => $site_name,
2371
 
2372
  $category_posts[] = array(
2373
 
2374
+ '@type' => $schema_type,
2375
  'headline' => get_the_title(),
2376
  'url' => get_the_permalink(),
2377
  'datePublished' => get_the_date('c'),
2379
  'mainEntityOfPage' => get_the_permalink(),
2380
  'author' => get_the_author(),
2381
  'publisher' => $publisher_info,
2382
+ 'image' => $archive_image,
2383
  );
2384
 
2385
  endwhile;
2407
  }
2408
  }
2409
 
2410
+ /**
2411
+ * Author Schema Markup
2412
+ * @global type $post
2413
+ * @global type $sd_data
2414
+ * @return type
2415
+ */
2416
  function saswp_author_output()
2417
  {
2418
+ global $post, $sd_data;
2419
+ $post_id ='';
2420
+
2421
  if(isset($sd_data['saswp_archive_schema']) && $sd_data['saswp_archive_schema'] == 1){
2422
+
2423
+ if(is_object($post)){
2424
+
2425
+ $post_id = $post->ID;
2426
+
2427
+ }
2428
+
2429
+ if(is_author() && $post_id){
2430
  // Get author from post content
2431
  $post_content = get_post($post_id);
2432
  $post_author = get_userdata($post_content->post_author);
2469
  }
2470
  }
2471
 
2472
+ /**
2473
+ * About page schema markup
2474
+ * @global type $sd_data
2475
+ * @return type
2476
+ */
2477
  function saswp_about_page_output()
2478
  {
2479
  global $sd_data;
2512
  }
2513
 
2514
  }
2515
+ /**
2516
+ * SiteNavigation Schema Markup
2517
+ * @global type $sd_data
2518
+ * @return type
2519
+ */
2520
+ function saswp_site_navigation_output(){
2521
+
2522
+ global $sd_data;
2523
+ $input = array();
2524
+
2525
+ $menuLocations = get_nav_menu_locations();
2526
+
2527
+ if(!empty($menuLocations) && (isset($sd_data['saswp_site_navigation_menu']) && $sd_data['saswp_site_navigation_menu'] == 1 ) ){
2528
+
2529
+ $navObj = array();
2530
+
2531
+ foreach($menuLocations as $type => $id){
2532
+
2533
+ $menuItems = wp_get_nav_menu_items($id);
2534
+
2535
+ if($menuItems){
2536
+
2537
+ if(!saswp_non_amp()){
2538
+
2539
+ if($type == 'amp-menu'){
2540
+
2541
+ foreach($menuItems as $items){
2542
+
2543
+ $navObj[] = array(
2544
+ "@context" => "https://schema.org",
2545
+ "@type" => "SiteNavigationElement",
2546
+ "@id" => trailingslashit(get_home_url()).$type,
2547
+ "name" => $items->title,
2548
+ "url" => $items->url
2549
+ );
2550
 
2551
+ }
2552
+
2553
+ }
2554
+
2555
+ }else{
2556
+
2557
+ if($type != 'amp-menu'){
2558
+
2559
+ foreach($menuItems as $items){
2560
+
2561
+ $navObj[] = array(
2562
+ "@context" => "https://schema.org",
2563
+ "@type" => "SiteNavigationElement",
2564
+ "@id" => trailingslashit(get_home_url()).$type,
2565
+ "name" => $items->title,
2566
+ "url" => $items->url
2567
+ );
2568
+
2569
+ }
2570
+
2571
+ }
2572
+
2573
+ }
2574
+
2575
+ }
2576
+
2577
+ }
2578
+
2579
+ if($navObj){
2580
+
2581
+ $input['@context'] = 'https://schema.org';
2582
+ $input['@graph'] = $navObj;
2583
+
2584
+ }
2585
+
2586
+ }
2587
+
2588
+ return $input;
2589
+ }
2590
  // For Contact Page
2591
  function saswp_contact_page_output()
2592
  {
2643
 
2644
  $post_comments = get_comments( array(
2645
  'post_id' => $post_id,
2646
+ 'number' => $count,
2647
+ 'status' => 'approve',
2648
+ 'type' => 'comment'
2649
  )
2650
  );
2651
 
2652
  if ( count( $post_comments ) ) {
2653
  foreach ( $post_comments as $comment ) {
2654
  $comments[] = array (
2655
+ '@type' => 'Comment',
2656
  'dateCreated' => $comment->comment_date,
2657
  'description' => $comment->comment_content,
2658
  'author' => array (
2659
  '@type' => 'Person',
2660
+ 'name' => $comment->comment_author,
2661
+ 'url' => $comment->comment_author_url,
2662
  ),
2663
  );
2664
  }
2668
  }
2669
 
2670
  function saswp_get_schema_data($schema_id, $schema_key){
2671
+
2672
  $details = array();
2673
+
2674
  if($schema_id && $schema_key){
2675
+
2676
+ $details = esc_sql ( get_post_meta($schema_id, $schema_key, true));
2677
+
2678
  }
2679
+
2680
  return $details;
2681
  }
2682
 
2733
 
2734
  if($type =='saswp_string'){
2735
 
2736
+ if(isset($data[$index])){
2737
+ return $data[$index];
2738
+ }else{
2739
+ return '';
2740
+ }
2741
  }
2742
  }
output/service.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php
2
  Class saswp_output_service{
 
3
  public function __construct() {
4
 
5
  }
@@ -783,6 +784,67 @@ Class saswp_output_service{
783
 
784
  }
785
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
786
  public function saswp_dw_question_answers_details($post_id){
787
 
788
  global $sd_data;
@@ -1148,58 +1210,45 @@ Class saswp_output_service{
1148
  public function saswp_schema_markup_generator($schema_type){
1149
 
1150
  global $sd_data;
1151
- $logo ='';
1152
- $height ='';
1153
- $width ='';
1154
- $site_name ='';
 
 
1155
 
1156
- $input1 = array();
1157
 
1158
- $author_id = get_the_author_meta('ID');
1159
- $image_id = get_post_thumbnail_id();
1160
- $image_details = wp_get_attachment_image_src($image_id, 'full');
1161
- $author_details = get_avatar_data($author_id);
1162
- $date = get_the_date("Y-m-d\TH:i:s\Z");
1163
- $modified_date = get_the_modified_date("Y-m-d\TH:i:s\Z");
1164
- $aurthor_name = get_the_author();
1165
 
1166
-
1167
- if(isset($sd_data['sd_logo'])){
1168
-
1169
- $logo = $sd_data['sd_logo']['url'];
1170
  }
1171
-
1172
-
1173
  if(isset($sd_data['sd_name']) && $sd_data['sd_name'] !=''){
1174
- $site_name = $sd_data['sd_name'];
 
 
1175
  }else{
1176
- $site_name = get_bloginfo();
1177
- }
1178
-
1179
- if('' != $logo && !empty($logo)){
1180
 
1181
- $height = $sd_data['sd_logo']['height'];
1182
- $width = $sd_data['sd_logo']['width'];
1183
-
1184
- }else{
1185
- $sizes = array(
1186
- 'width' => 600,
1187
- 'height' => 60,
1188
- 'crop' => false,
1189
- );
1190
-
1191
- $custom_logo_id = get_theme_mod( 'custom_logo' );
1192
- $custom_logo = wp_get_attachment_image_src( $custom_logo_id, $sizes);
1193
- $logo = $custom_logo[0];
1194
- $height = $custom_logo[1];
1195
- $width = $custom_logo[2];
1196
- }
1197
-
1198
 
 
1199
 
 
 
 
 
 
 
 
 
1200
  switch ($schema_type) {
1201
 
1202
  case 'Article':
 
1203
  $input1 = array(
1204
  '@context' => 'http://schema.org',
1205
  '@type' => 'Article',
1
  <?php
2
  Class saswp_output_service{
3
+
4
  public function __construct() {
5
 
6
  }
784
 
785
  }
786
 
787
+ // public function saswp_wp_job_manager_details($post = null){
788
+ //
789
+ // $post = get_post( $post );
790
+ //
791
+ // if ( ! $post || 'job_listing' !== $post->post_type ) {
792
+ // return false;
793
+ // }
794
+ //
795
+ // $data = array();
796
+ // $data['@context'] = 'http://schema.org/';
797
+ // $data['@type'] = 'JobPosting';
798
+ // $data['datePosted'] = get_post_time( 'c', false, $post );
799
+ //
800
+ // $job_expires = get_post_meta( $post->ID, '_job_expires', true );
801
+ // if ( ! empty( $job_expires ) ) {
802
+ // $data['validThrough'] = date( 'c', strtotime( $job_expires ) );
803
+ // }
804
+ //
805
+ // $data['title'] = wp_strip_all_tags( wpjm_get_the_job_title( $post ) );
806
+ // $data['description'] = wpjm_get_the_job_description( $post );
807
+ //
808
+ // $employment_types = wpjm_get_job_employment_types();
809
+ // if ( ! empty( $employment_types ) ) {
810
+ // $data['employmentType'] = $employment_types;
811
+ // }
812
+ //
813
+ // $data['hiringOrganization'] = array();
814
+ // $data['hiringOrganization']['@type'] = 'Organization';
815
+ // $data['hiringOrganization']['name'] = get_the_company_name( $post );
816
+ //
817
+ // $company_website = get_the_company_website( $post );
818
+ // if ( $company_website ) {
819
+ // $data['hiringOrganization']['sameAs'] = $company_website;
820
+ // $data['hiringOrganization']['url'] = $company_website;
821
+ // }
822
+ //
823
+ // $company_logo = get_the_company_logo( $post, 'full' );
824
+ // if ( $company_logo ) {
825
+ // $data['hiringOrganization']['logo'] = $company_logo;
826
+ // }
827
+ //
828
+ // $data['identifier'] = array();
829
+ // $data['identifier']['@type'] = 'PropertyValue';
830
+ // $data['identifier']['name'] = get_the_company_name( $post );
831
+ // $data['identifier']['value'] = get_the_guid( $post );
832
+ //
833
+ // $location = get_the_job_location( $post );
834
+ // if ( ! empty( $location ) ) {
835
+ // $data['jobLocation'] = array();
836
+ // $data['jobLocation']['@type'] = 'Place';
837
+ // $data['jobLocation']['address'] = wpjm_get_job_listing_location_structured_data( $post );
838
+ // if ( empty( $data['jobLocation']['address'] ) ) {
839
+ // $data['jobLocation']['address'] = $location;
840
+ // }
841
+ // }
842
+ //
843
+ // //return $data;
844
+ //
845
+ // }
846
+
847
+
848
  public function saswp_dw_question_answers_details($post_id){
849
 
850
  global $sd_data;
1210
  public function saswp_schema_markup_generator($schema_type){
1211
 
1212
  global $sd_data;
1213
+ $logo = '';
1214
+ $height = '';
1215
+ $width = '';
1216
+ $site_name = '';
1217
+
1218
+ $default_logo = $this->saswp_get_publisher(true);
1219
 
1220
+ if(!empty($default_logo)){
1221
 
1222
+ $logo = $default_logo['url'];
1223
+ $height = $default_logo['height'];
1224
+ $width = $default_logo['width'];
 
 
 
 
1225
 
 
 
 
 
1226
  }
1227
+
 
1228
  if(isset($sd_data['sd_name']) && $sd_data['sd_name'] !=''){
1229
+
1230
+ $site_name = $sd_data['sd_name'];
1231
+
1232
  }else{
 
 
 
 
1233
 
1234
+ $site_name = get_bloginfo();
1235
+
1236
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1237
 
1238
+ $input1 = array();
1239
 
1240
+ $author_id = get_the_author_meta('ID');
1241
+ $image_id = get_post_thumbnail_id();
1242
+ $image_details = wp_get_attachment_image_src($image_id, 'full');
1243
+ $author_details = get_avatar_data($author_id);
1244
+ $date = get_the_date("Y-m-d\TH:i:s\Z");
1245
+ $modified_date = get_the_modified_date("Y-m-d\TH:i:s\Z");
1246
+ $aurthor_name = get_the_author();
1247
+
1248
  switch ($schema_type) {
1249
 
1250
  case 'Article':
1251
+
1252
  $input1 = array(
1253
  '@context' => 'http://schema.org',
1254
  '@type' => 'Article',
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: mohammed_kaludi, ahmedkaludi, ampforwp
3
  Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
4
  Requires at least: 3.0
5
  Tested up to: 5.0.2
6
- Stable tag: 1.0.8.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -65,6 +65,15 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)
65
 
66
  == Changelog ==
67
 
 
 
 
 
 
 
 
 
 
68
  = 1.0.8.1 (31 January 2019) =
69
 
70
  * Bug Fixed: JSON-LD Error, when yoast compatibility is enabled #133
3
  Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
4
  Requires at least: 3.0
5
  Tested up to: 5.0.2
6
+ Stable tag: 1.0.9
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
65
 
66
  == Changelog ==
67
 
68
+ = 1.0.9 (07 February 2019) =
69
+
70
+ * New Feature: SiteNavigationElement schema type add to the schema type list #115
71
+ * Added: Option to edit the Schema type for Archive page #123
72
+ * Added: Menu Property to FoodEstablishment #116
73
+ * Bug Fixed: On/Off buttons inside modify schema are not changing its state on post save #138
74
+ * Bug Fixed: Yoast compatibility checkbox is not active when yoast premium plugin is activated #138
75
+
76
+
77
  = 1.0.8.1 (31 January 2019) =
78
 
79
  * Bug Fixed: JSON-LD Error, when yoast compatibility is enabled #133
structured-data-for-wp.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Schema & Structured Data for WP
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.0.8.1
6
  Text Domain: schema-and-structured-data-for-wp
7
  Domain Path: /languages
8
  Author: Mohammed Kaludi, Ahmed Kaludi
@@ -13,7 +13,7 @@ License: GPL2
13
  // Exit if accessed directly.
14
  if ( ! defined( 'ABSPATH' ) ) exit;
15
 
16
- define('SASWP_VERSION', '1.0.8.1');
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
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.0.9
6
  Text Domain: schema-and-structured-data-for-wp
7
  Domain Path: /languages
8
  Author: Mohammed Kaludi, Ahmed Kaludi
13
  // Exit if accessed directly.
14
  if ( ! defined( 'ABSPATH' ) ) exit;
15
 
16
+ define('SASWP_VERSION', '1.0.9');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
view/post_specific.php CHANGED
@@ -38,10 +38,22 @@ class saswp_post_specific {
38
  $post_id = sanitize_text_field($_POST['post_id']);
39
  $schema_id = sanitize_text_field($_POST['schema_id']);
40
  $status = sanitize_text_field($_POST['status']);
 
41
 
42
- $schema_enable = get_post_meta($post_id, 'saswp_enable_disable_schema', true);
43
-
44
- $schema_enable[$schema_id] = $status;
 
 
 
 
 
 
 
 
 
 
 
45
  update_post_meta( $post_id, 'saswp_enable_disable_schema', $schema_enable);
46
 
47
  echo json_encode(array('status'=>'t'));
@@ -105,6 +117,7 @@ class saswp_post_specific {
105
 
106
  $schema_enable = get_post_meta($post->ID, 'saswp_enable_disable_schema', true);
107
 
 
108
  if(count($this->all_schema)>1){
109
 
110
  foreach($this->all_schema as $key => $schema){
@@ -994,6 +1007,18 @@ class saswp_post_specific {
994
  'id' => 'local_price_range_'.$schema_id,
995
  'type' => 'text',
996
  'default' => $business_details['local_price_range']
 
 
 
 
 
 
 
 
 
 
 
 
997
  ),
998
  array(
999
  'label' => 'Aggregate Rating',
38
  $post_id = sanitize_text_field($_POST['post_id']);
39
  $schema_id = sanitize_text_field($_POST['schema_id']);
40
  $status = sanitize_text_field($_POST['status']);
41
+
42
 
43
+ $schema_enable_status = get_post_meta($post_id, 'saswp_enable_disable_schema', true);
44
+
45
+ if(is_array($schema_enable_status)){
46
+
47
+ $schema_enable = $schema_enable_status;
48
+
49
+ }else{
50
+
51
+ delete_post_meta($post_id, 'saswp_enable_disable_schema');
52
+
53
+ }
54
+
55
+ $schema_enable[$schema_id] = $status;
56
+
57
  update_post_meta( $post_id, 'saswp_enable_disable_schema', $schema_enable);
58
 
59
  echo json_encode(array('status'=>'t'));
117
 
118
  $schema_enable = get_post_meta($post->ID, 'saswp_enable_disable_schema', true);
119
 
120
+
121
  if(count($this->all_schema)>1){
122
 
123
  foreach($this->all_schema as $key => $schema){
1007
  'id' => 'local_price_range_'.$schema_id,
1008
  'type' => 'text',
1009
  'default' => $business_details['local_price_range']
1010
+ ),
1011
+ array(
1012
+ 'label' => 'Menu',
1013
+ 'id' => 'local_menu_'.$schema_id,
1014
+ 'type' => 'text',
1015
+ 'default' => $business_details['local_menu']
1016
+ ),
1017
+ array(
1018
+ 'label' => 'Serves Cuisine',
1019
+ 'id' => 'local_serves_cuisine_'.$schema_id,
1020
+ 'type' => 'text',
1021
+ 'default' => $business_details['local_serves_cuisine']
1022
  ),
1023
  array(
1024
  'label' => 'Aggregate Rating',
view/schema_type.php CHANGED
@@ -297,6 +297,15 @@ function item_reviewed_fields($item, $post_specific = null, $schema_id = null){
297
  'placeholder' => 'Serves Cuisine'
298
  )
299
  );
 
 
 
 
 
 
 
 
 
300
  break;
301
  case 'Series':
302
  $reviewed_field = array();
@@ -381,8 +390,8 @@ function item_reviewed_fields($item, $post_specific = null, $schema_id = null){
381
 
382
  }else{
383
 
384
- $schema_data = get_post_meta( $schema_id, 'saswp_review_schema_details', true );
385
- $meta_value = $schema_data[$meta_field['id']];
386
 
387
  }
388
 
@@ -543,7 +552,7 @@ function item_reviewed_fields($item, $post_specific = null, $schema_id = null){
543
 
544
  $business_type = esc_sql ( get_post_meta($post->ID, 'saswp_business_type', true) );
545
  $business_name = esc_sql ( get_post_meta($post->ID, 'saswp_business_name', true) );
546
- $business_details = esc_sql ( get_post_meta($post->ID, 'saswp_local_business_details', true) );
547
  $dayoftheweek = get_post_meta($post->ID, 'saswp_dayofweek', true);
548
 
549
  break;
@@ -639,6 +648,7 @@ function item_reviewed_fields($item, $post_specific = null, $schema_id = null){
639
  'Article' => 'Article',
640
  'AudioObject' => 'AudioObject',
641
  'Blogposting' => 'Blogposting',
 
642
  'local_business' => 'Local Business',
643
  'NewsArticle' => 'NewsArticle',
644
  'Product' => 'Product',
@@ -820,11 +830,18 @@ function item_reviewed_fields($item, $post_specific = null, $schema_id = null){
820
  }
821
  ?>
822
  </select>
 
823
  <?php if($schema_type == 'qanda') { ?>
824
  <span class="saswp-schem-type-note">Note: Currently supported with DW Question & Answer <a target="_blank" href="https://wordpress.org/plugins/dw-question-answer/">Link</a></span>
825
  <?php }else{ ?>
826
  <span class="saswp-schem-type-note saswp_hide">Note: Currently supported with DW Question & Answer <a target="_blank" href="https://wordpress.org/plugins/dw-question-answer/">Link</a></span>
827
  <?php } ?>
 
 
 
 
 
 
828
 
829
  </td>
830
  </tr>
@@ -1090,6 +1107,16 @@ function item_reviewed_fields($item, $post_specific = null, $schema_id = null){
1090
  <td><input value="<?php if(isset($business_details['local_price_range'])){echo esc_attr($business_details['local_price_range']); } ?>" type="text" name="local_price_range" placeholder="<?php echo esc_html__('$10-$50 or $$$ ', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1091
  </tr>
1092
 
 
 
 
 
 
 
 
 
 
 
1093
 
1094
  <tr class="saswp-business-text-field-tr" <?php echo $style_business_type; ?>>
1095
  <td><?php echo esc_html__('Aggregate Rating', 'schema-and-structured-data-for-wp' ); ?></td>
@@ -1455,6 +1482,14 @@ function item_reviewed_fields($item, $post_specific = null, $schema_id = null){
1455
  $local_business_details['local_price_range'] = sanitize_text_field($_POST['local_price_range']);
1456
  }
1457
 
 
 
 
 
 
 
 
 
1458
  if ( isset( $_POST['local_enable_rating'] ) ){
1459
  $local_business_details['local_enable_rating'] = sanitize_text_field($_POST['local_enable_rating']);
1460
  }
297
  'placeholder' => 'Serves Cuisine'
298
  )
299
  );
300
+ $reviewed_field[] = array(
301
+ 'label' => 'Menu',
302
+ 'id' => 'saswp_review_schema_menu'.$post_fix,
303
+ 'type' => 'text',
304
+ 'default' => '',
305
+ 'attributes' => array(
306
+ 'placeholder' => 'https://example.com/menu'
307
+ )
308
+ );
309
  break;
310
  case 'Series':
311
  $reviewed_field = array();
390
 
391
  }else{
392
 
393
+ $schema_data = get_post_meta( $schema_id, 'saswp_review_schema_details', true );
394
+ $meta_value = $schema_data[$meta_field['id']];
395
 
396
  }
397
 
552
 
553
  $business_type = esc_sql ( get_post_meta($post->ID, 'saswp_business_type', true) );
554
  $business_name = esc_sql ( get_post_meta($post->ID, 'saswp_business_name', true) );
555
+ $business_details = esc_sql ( get_post_meta($post->ID, 'saswp_local_business_details', true) );
556
  $dayoftheweek = get_post_meta($post->ID, 'saswp_dayofweek', true);
557
 
558
  break;
648
  'Article' => 'Article',
649
  'AudioObject' => 'AudioObject',
650
  'Blogposting' => 'Blogposting',
651
+ // 'JobPosting' => 'JobPosting',
652
  'local_business' => 'Local Business',
653
  'NewsArticle' => 'NewsArticle',
654
  'Product' => 'Product',
830
  }
831
  ?>
832
  </select>
833
+
834
  <?php if($schema_type == 'qanda') { ?>
835
  <span class="saswp-schem-type-note">Note: Currently supported with DW Question & Answer <a target="_blank" href="https://wordpress.org/plugins/dw-question-answer/">Link</a></span>
836
  <?php }else{ ?>
837
  <span class="saswp-schem-type-note saswp_hide">Note: Currently supported with DW Question & Answer <a target="_blank" href="https://wordpress.org/plugins/dw-question-answer/">Link</a></span>
838
  <?php } ?>
839
+
840
+ <?php if($schema_type == 'JobPosting') { ?>
841
+ <!--<span class="saswp-job-posting-note">Note: Currently supported with WP Job Manager <a target="_blank" href="https://wordpress.org/plugins/wp-job-manager/">Link</a></span>-->
842
+ <?php }else{ ?>
843
+ <!--<span class="saswp-job-posting-note saswp_hide">Note: Currently supported with WP Job Manager <a target="_blank" href="https://wordpress.org/plugins/wp-job-manager/">Link</a></span>-->
844
+ <?php } ?>
845
 
846
  </td>
847
  </tr>
1107
  <td><input value="<?php if(isset($business_details['local_price_range'])){echo esc_attr($business_details['local_price_range']); } ?>" type="text" name="local_price_range" placeholder="<?php echo esc_html__('$10-$50 or $$$ ', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1108
  </tr>
1109
 
1110
+ <tr class="saswp-business-text-field-tr" <?php echo $style_business_type; ?>>
1111
+ <td><?php echo esc_html__('Menu', 'schema-and-structured-data-for-wp' ); ?></td>
1112
+ <td><input value="<?php if(isset($business_details['local_menu'])){echo esc_attr($business_details['local_menu']); } ?>" type="text" name="local_menu" placeholder="<?php echo esc_html__('http://www.example.com/menu', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1113
+ </tr>
1114
+
1115
+ <tr class="saswp-business-text-field-tr" <?php echo $style_business_type; ?>>
1116
+ <td><?php echo esc_html__('Serves Cuisine ', 'schema-and-structured-data-for-wp' ); ?></td>
1117
+ <td><input value="<?php echo esc_attr($business_details['local_serves_cuisine']); ?>" type="text" name="local_serves_cuisine" placeholder="<?php echo esc_html__('American, Chinese', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1118
+ </tr>
1119
+
1120
 
1121
  <tr class="saswp-business-text-field-tr" <?php echo $style_business_type; ?>>
1122
  <td><?php echo esc_html__('Aggregate Rating', 'schema-and-structured-data-for-wp' ); ?></td>
1482
  $local_business_details['local_price_range'] = sanitize_text_field($_POST['local_price_range']);
1483
  }
1484
 
1485
+ if ( isset( $_POST['local_menu'] ) ){
1486
+ $local_business_details['local_menu'] = sanitize_text_field($_POST['local_menu']);
1487
+ }
1488
+
1489
+ if ( isset( $_POST['local_serves_cuisine'] ) ){
1490
+ $local_business_details['local_serves_cuisine'] = sanitize_text_field($_POST['local_serves_cuisine']);
1491
+ }
1492
+
1493
  if ( isset( $_POST['local_enable_rating'] ) ){
1494
  $local_business_details['local_enable_rating'] = sanitize_text_field($_POST['local_enable_rating']);
1495
  }