Schema & Structured Data for WP & AMP - Version 1.9.80

Version Description

(23 Jun 2021) =

  • Fixed: Item name mismatches when We try to activate "1-Click Indexing API Integration" extension. #1454
  • Fixed: Validation error in GSC: Unparable structured data (incorrect value type) #1452
  • Fixed: Availability should have full string like what mentioned in google example. Such as "https://schema.org/InStock" #1453
  • Fixed: Recipe schema's properties should be in proper order #1450
  • Added: Schedule property to Event schema #1044
  • Added: Author placement option #1281
  • Added: Book Guteberg block #930
  • Added: Creative Work schema #1204
  • Added: Visual Artwork schema #1377
  • Added: Integration with multi-currency plugin for woocommerce. #1160
Download this release

Release Info

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

Code changes from version 1.9.79 to 1.9.80

admin_section/common-function.php CHANGED
@@ -3981,6 +3981,7 @@ function saswp_get_condition_list($condition, $search = '', $saved_data = ''){
3981
  break;
3982
 
3983
  case "homepage":
 
3984
  $array_search = true;
3985
  $choices = array(
3986
  array('id' => 'true', 'text' => 'True'),
@@ -4229,4 +4230,57 @@ function saswp_format_time_to_ISO_8601($string) {
4229
  }
4230
 
4231
  return $string;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4232
  }
3981
  break;
3982
 
3983
  case "homepage":
3984
+ case "author":
3985
  $array_search = true;
3986
  $choices = array(
3987
  array('id' => 'true', 'text' => 'True'),
4230
  }
4231
 
4232
  return $string;
4233
+ }
4234
+
4235
+ function saswp_prepend_schema_org( $short_str ){
4236
+
4237
+ $response = '';
4238
+
4239
+ switch (strtolower($short_str)) {
4240
+
4241
+ case 'instock':
4242
+ $response = 'https://schema.org/InStock';
4243
+ break;
4244
+
4245
+ case 'soldout':
4246
+ $response = 'https://schema.org/SoldOut';
4247
+ break;
4248
+
4249
+ case 'presale':
4250
+ $response = 'https://schema.org/PreSale';
4251
+ break;
4252
+
4253
+ case 'onlineonly':
4254
+ $response = 'https://schema.org/OnlineOnly';
4255
+ break;
4256
+
4257
+ case 'limitedavailability':
4258
+ $response = 'https://schema.org/LimitedAvailability';
4259
+ break;
4260
+
4261
+ case 'instoreonly':
4262
+ $response = 'https://schema.org/InStoreOnly';
4263
+ break;
4264
+
4265
+ case 'outofstock':
4266
+ $response = 'https://schema.org/OutOfStock';
4267
+ break;
4268
+
4269
+ case 'discontinued':
4270
+ $response = 'https://schema.org/Discontinued';
4271
+ break;
4272
+
4273
+ case 'onbackorder':
4274
+ $response = 'https://schema.org/BackOrder';
4275
+ break;
4276
+ case 'preorder':
4277
+ $response = 'https://schema.org/PreOrder';
4278
+ break;
4279
+
4280
+ default:
4281
+
4282
+ break;
4283
+ }
4284
+
4285
+ return $response;
4286
  }
admin_section/settings.php CHANGED
@@ -1913,6 +1913,13 @@ function saswp_get_license_section_html($on, $license_key, $license_status, $lic
1913
 
1914
  $response.= '<div class="saswp-tools-field-title">';
1915
 
 
 
 
 
 
 
 
1916
  if($label == true && $on == 'Polylang'){
1917
 
1918
  $response.= '<div class="saswp-license-label">';
1913
 
1914
  $response.= '<div class="saswp-tools-field-title">';
1915
 
1916
+ if($label == true && $on == 'OCIAIFS'){
1917
+
1918
+ $response.= '<div class="saswp-license-label">';
1919
+ $response.= '<strong>'.saswp_t_string('1-Click Indexing API Integration').'</strong>';
1920
+ $response.= '</div>';
1921
+
1922
+ }
1923
  if($label == true && $on == 'Polylang'){
1924
 
1925
  $response.= '<div class="saswp-license-label">';
admin_section/structure_admin.php CHANGED
@@ -400,6 +400,27 @@ function saswp_comparison_logic_checker($input, $post){
400
 
401
  break;
402
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
403
  // Logged in User Type
404
  case 'user_type':
405
  if ( $comparison == 'equal') {
@@ -806,7 +827,8 @@ if(is_admin()){
806
  'post_type' => saswp_t_string("Post Type"),
807
  'show_globally' => saswp_t_string("Show Globally"),
808
  'user_type' => saswp_t_string("Logged in User Type"),
809
- 'homepage' => saswp_t_string("Homepage"),
 
810
  ),
811
  saswp_t_string("Post") => array(
812
  'post' => saswp_t_string("Post"),
@@ -1743,7 +1765,7 @@ function saswp_license_status($add_on, $license_status, $license_key){
1743
  'rs' => 'Recipe Schema',
1744
  'qanda' => 'Q&A Schema Compatibility',
1745
  'faq' => 'FAQ Schema Compatibility',
1746
- 'ociaifs' => '1 Click Indexing Api Integration For SASWP'
1747
  );
1748
 
1749
  $edd_action = '';
400
 
401
  break;
402
 
403
+ case 'author':
404
+
405
+ $author ='false';
406
+
407
+ if( is_author() ){
408
+ $author = 'true';
409
+ }
410
+
411
+ if ( $comparison == 'equal' ) {
412
+ if ( $author == $data ) {
413
+ $result = true;
414
+ }
415
+ }
416
+ if ( $comparison == 'not_equal') {
417
+ if ( $author != $data ) {
418
+ $result = true;
419
+ }
420
+ }
421
+
422
+ break;
423
+
424
  // Logged in User Type
425
  case 'user_type':
426
  if ( $comparison == 'equal') {
827
  'post_type' => saswp_t_string("Post Type"),
828
  'show_globally' => saswp_t_string("Show Globally"),
829
  'user_type' => saswp_t_string("Logged in User Type"),
830
+ 'homepage' => saswp_t_string("Homepage"),
831
+ 'author' => saswp_t_string("Author"),
832
  ),
833
  saswp_t_string("Post") => array(
834
  'post' => saswp_t_string("Post"),
1765
  'rs' => 'Recipe Schema',
1766
  'qanda' => 'Q&A Schema Compatibility',
1767
  'faq' => 'FAQ Schema Compatibility',
1768
+ 'ociaifs' => '1-Click Indexing API Integration'
1769
  );
1770
 
1771
  $edd_action = '';
core/array-list/schema-properties.php CHANGED
@@ -635,13 +635,7 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
635
  'id' => 'saswp_webpage_section_'.$schema_id,
636
  'type' => 'textarea',
637
  'default' => saswp_strip_all_tags(get_the_excerpt())
638
- ),
639
- array(
640
- 'label' => 'Webpage Body',
641
- 'id' => 'saswp_webpage_body_'.$schema_id,
642
- 'type' => 'textarea',
643
- 'default' => is_object($post) ? saswp_strip_all_tags($post->post_content) : ''
644
- ),
645
  array(
646
  'label' => 'Keywords',
647
  'id' => 'saswp_webpage_keywords_'.$schema_id,
@@ -944,6 +938,225 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
944
  );
945
  break;
946
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
947
  case 'SpecialAnnouncement':
948
 
949
  $category_detail =get_the_category(get_the_ID());//$post->ID
@@ -1266,6 +1479,42 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
1266
  'id' => 'saswp_event_schema_end_time_'.$schema_id,
1267
  'type' => 'text',
1268
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1269
  array(
1270
  'label' => 'Image',
1271
  'id' => 'saswp_event_schema_image_'.$schema_id,
@@ -1639,6 +1888,12 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
1639
  'type' => 'text',
1640
  'default' => saswp_get_the_title()
1641
  ),
 
 
 
 
 
 
1642
  array(
1643
  'label' => 'Image',
1644
  'id' => 'saswp_recipe_image_'.$schema_id,
@@ -1655,13 +1910,7 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
1655
  'id' => 'saswp_recipe_date_modified_'.$schema_id,
1656
  'type' => 'text',
1657
  'default' => get_the_modified_date("Y-m-d")
1658
- ),
1659
- array(
1660
- 'label' => 'Description',
1661
- 'id' => 'saswp_recipe_description_'.$schema_id,
1662
- 'type' => 'textarea',
1663
- 'default' => saswp_strip_all_tags(get_the_excerpt())
1664
- ),
1665
  array(
1666
  'label' => 'Main Entity Id',
1667
  'id' => 'saswp_recipe_main_entity_'.$schema_id,
635
  'id' => 'saswp_webpage_section_'.$schema_id,
636
  'type' => 'textarea',
637
  'default' => saswp_strip_all_tags(get_the_excerpt())
638
+ ),
 
 
 
 
 
 
639
  array(
640
  'label' => 'Keywords',
641
  'id' => 'saswp_webpage_keywords_'.$schema_id,
938
  );
939
  break;
940
 
941
+ case 'VisualArtwork':
942
+ $meta_field = array(
943
+ array(
944
+ 'label' => 'URL',
945
+ 'id' => 'saswp_visualartwork_url_'.$schema_id,
946
+ 'type' => 'text',
947
+ 'default' => get_permalink(),
948
+ ),
949
+ array(
950
+ 'label' => 'Name',
951
+ 'id' => 'saswp_visualartwork_name_'.$schema_id,
952
+ 'type' => 'text',
953
+ 'default' => get_permalink(),
954
+ ),
955
+ array(
956
+ 'label' => 'Alternate Name',
957
+ 'id' => 'saswp_visualartwork_alternate_name_'.$schema_id,
958
+ 'type' => 'text',
959
+ 'default' => get_permalink(),
960
+ ),
961
+ array(
962
+ 'label' => 'Description',
963
+ 'id' => 'saswp_visualartwork_description_'.$schema_id,
964
+ 'type' => 'textarea',
965
+ 'default' => saswp_strip_all_tags(get_the_excerpt())
966
+ ),
967
+ array(
968
+ 'label' => 'Art form',
969
+ 'id' => 'saswp_visualartwork_artform_'.$schema_id,
970
+ 'type' => 'text',
971
+ 'default' => '',
972
+ ),
973
+ array(
974
+ 'label' => 'Art Edition',
975
+ 'id' => 'saswp_visualartwork_artedition_'.$schema_id,
976
+ 'type' => 'text',
977
+ 'default' => '',
978
+ ),
979
+ array(
980
+ 'label' => 'Art Work Surface',
981
+ 'id' => 'saswp_visualartwork_artwork_surface_'.$schema_id,
982
+ 'type' => 'text',
983
+ 'default' => '',
984
+ ),
985
+ array(
986
+ 'label' => 'Width',
987
+ 'id' => 'saswp_visualartwork_width_'.$schema_id,
988
+ 'type' => 'text',
989
+ 'default' => '',
990
+ ),
991
+ array(
992
+ 'label' => 'Height',
993
+ 'id' => 'saswp_visualartwork_height_'.$schema_id,
994
+ 'type' => 'text',
995
+ 'default' => '',
996
+ ),
997
+ array(
998
+ 'label' => 'Art Medium',
999
+ 'id' => 'saswp_visualartwork_artmedium_'.$schema_id,
1000
+ 'type' => 'textarea',
1001
+ 'default' => '',
1002
+ 'note' => 'Note: If There are more than one artmedium, Separate artmedium list by comma ( , )'
1003
+ ),
1004
+ array(
1005
+ 'label' => 'Image',
1006
+ 'id' => 'saswp_visualartwork_image_'.$schema_id,
1007
+ 'type' => 'media'
1008
+ ),
1009
+ array(
1010
+ 'label' => 'Date Created',
1011
+ 'id' => 'saswp_visualartwork_date_created_'.$schema_id,
1012
+ 'type' => 'text',
1013
+ 'default' => get_the_date("Y-m-d")
1014
+ ),
1015
+ array(
1016
+ 'label' => 'Creator Type',
1017
+ 'id' => 'saswp_visualartwork_author_type_'.$schema_id,
1018
+ 'type' => 'select',
1019
+ 'options' => array(
1020
+ 'Person' => 'Person',
1021
+ 'Organization' => 'Organization',
1022
+ )
1023
+ ),
1024
+ array(
1025
+ 'label' => 'Creator Name',
1026
+ 'id' => 'saswp_visualartwork_author_name_'.$schema_id,
1027
+ 'type' => 'text',
1028
+ 'default' => is_object($current_user) ? $current_user->display_name : ''
1029
+ ),
1030
+ array(
1031
+ 'label' => 'Creator Description',
1032
+ 'id' => 'saswp_visualartwork_author_description_'.$schema_id,
1033
+ 'type' => 'textarea',
1034
+ 'default' => $author_desc
1035
+ ),
1036
+ array(
1037
+ 'label' => 'Creator URL',
1038
+ 'id' => 'saswp_visualartwork_author_url_'.$schema_id,
1039
+ 'type' => 'text',
1040
+ 'default' => $author_url
1041
+ )
1042
+ );
1043
+ break;
1044
+
1045
+ case 'CreativeWork':
1046
+ $meta_field = array(
1047
+ array(
1048
+ 'label' => 'Main Entity Of Page',
1049
+ 'id' => 'saswp_creativework_main_entity_of_page_'.$schema_id,
1050
+ 'type' => 'text',
1051
+ 'default' => get_permalink()
1052
+ ),
1053
+ array(
1054
+ 'label' => 'URL',
1055
+ 'id' => 'saswp_creativework_url_'.$schema_id,
1056
+ 'type' => 'text',
1057
+ 'default' => get_permalink(),
1058
+ ),
1059
+ array(
1060
+ 'label' => 'Image',
1061
+ 'id' => 'saswp_creativework_image_'.$schema_id,
1062
+ 'type' => 'media'
1063
+ ),
1064
+ array(
1065
+ 'label' => 'inLanguage',
1066
+ 'id' => 'saswp_creativework_inlanguage_'.$schema_id,
1067
+ 'type' => 'text',
1068
+ 'default' => get_bloginfo('language'),
1069
+ ),
1070
+ array(
1071
+ 'label' => 'Headline',
1072
+ 'id' => 'saswp_creativework_headline_'.$schema_id,
1073
+ 'type' => 'text',
1074
+ 'default' => saswp_get_the_title()
1075
+ ),
1076
+ array(
1077
+ 'label' => 'Description',
1078
+ 'id' => 'saswp_creativework_description_'.$schema_id,
1079
+ 'type' => 'textarea',
1080
+ 'default' => saswp_strip_all_tags(get_the_excerpt())
1081
+ ),
1082
+ array(
1083
+ 'label' => 'Article Section',
1084
+ 'id' => 'saswp_creativework_section_'.$schema_id,
1085
+ 'type' => 'textarea',
1086
+ 'default' => saswp_strip_all_tags(get_the_excerpt())
1087
+ ),
1088
+ array(
1089
+ 'label' => 'Article Body',
1090
+ 'id' => 'saswp_creativework_body_'.$schema_id,
1091
+ 'type' => 'textarea',
1092
+ 'default' => is_object($post) ? saswp_strip_all_tags($post->post_content) : ''
1093
+ ),
1094
+ array(
1095
+ 'label' => 'Keywords',
1096
+ 'id' => 'saswp_creativework_keywords_'.$schema_id,
1097
+ 'type' => 'text',
1098
+ 'default' => saswp_get_the_tags()
1099
+ ),
1100
+ array(
1101
+ 'label' => 'Date Published',
1102
+ 'id' => 'saswp_creativework_date_published_'.$schema_id,
1103
+ 'type' => 'text',
1104
+ 'default' => get_the_date("Y-m-d")
1105
+ ),
1106
+ array(
1107
+ 'label' => 'Date Modified',
1108
+ 'id' => 'saswp_creativework_date_modified_'.$schema_id,
1109
+ 'type' => 'text',
1110
+ 'default' => get_the_modified_date("Y-m-d")
1111
+ ),
1112
+ array(
1113
+ 'label' => 'Author Type',
1114
+ 'id' => 'saswp_creativework_author_type_'.$schema_id,
1115
+ 'type' => 'select',
1116
+ 'options' => array(
1117
+ 'Person' => 'Person',
1118
+ 'Organization' => 'Organization',
1119
+ )
1120
+ ),
1121
+ array(
1122
+ 'label' => 'Author Name',
1123
+ 'id' => 'saswp_creativework_author_name_'.$schema_id,
1124
+ 'type' => 'text',
1125
+ 'default' => is_object($current_user) ? $current_user->display_name : ''
1126
+ ),
1127
+ array(
1128
+ 'label' => 'Author Description',
1129
+ 'id' => 'saswp_creativework_author_description_'.$schema_id,
1130
+ 'type' => 'textarea',
1131
+ 'default' => $author_desc
1132
+ ),
1133
+ array(
1134
+ 'label' => 'Author URL',
1135
+ 'id' => 'saswp_creativework_author_url_'.$schema_id,
1136
+ 'type' => 'text',
1137
+ 'default' => $author_url
1138
+ ),
1139
+ array(
1140
+ 'label' => 'Editor Name',
1141
+ 'id' => 'saswp_creativework_editor_name_'.$schema_id,
1142
+ 'type' => 'text',
1143
+ 'default' => is_object($current_user) ? $current_user->display_name : ''
1144
+ ),
1145
+ array(
1146
+ 'label' => 'Organization Name',
1147
+ 'id' => 'saswp_creativework_organization_name_'.$schema_id,
1148
+ 'type' => 'text',
1149
+ 'default' => saswp_remove_warnings($sd_data, 'sd_name', 'saswp_string')
1150
+ ),
1151
+ array(
1152
+ 'label' => 'Organization Logo',
1153
+ 'id' => 'saswp_creativework_organization_logo_'.$schema_id,
1154
+ 'type' => 'media',
1155
+ 'default' => isset($sd_data['sd_logo']['url']) ? $sd_data['sd_logo']['url']:''
1156
+ )
1157
+ );
1158
+ break;
1159
+
1160
  case 'SpecialAnnouncement':
1161
 
1162
  $category_detail =get_the_category(get_the_ID());//$post->ID
1479
  'id' => 'saswp_event_schema_end_time_'.$schema_id,
1480
  'type' => 'text',
1481
  ),
1482
+ array(
1483
+ 'label' => 'Schedule Repeat Frequency',
1484
+ 'id' => 'saswp_event_schema_schedule_repeat_frequency_'.$schema_id,
1485
+ 'type' => 'select',
1486
+ 'options' => array(
1487
+ '' => 'Choose',
1488
+ 'P1W' => 'Weekly',
1489
+ 'P1M' => 'Monthly',
1490
+ 'P1D' => 'EveryDay',
1491
+ )
1492
+ ),
1493
+ array(
1494
+ 'label' => 'Schedule byDay',
1495
+ 'id' => 'saswp_event_schema_schedule_by_day_'.$schema_id,
1496
+ 'type' => 'textarea',
1497
+ 'attributes' => array(
1498
+ 'placeholder' => 'Monday, Wednesday'
1499
+ ),
1500
+ 'note' => 'Note: Separate it by comma ( , )'
1501
+ ),
1502
+ array(
1503
+ 'label' => 'Schedule byMonthDay',
1504
+ 'id' => 'saswp_event_schema_schedule_by_month_day_'.$schema_id,
1505
+ 'type' => 'text',
1506
+ 'attributes' => array(
1507
+ 'placeholder' => '1, 13, 24'
1508
+ )
1509
+ ),
1510
+ array(
1511
+ 'label' => 'Schedule Timezone',
1512
+ 'id' => 'saswp_event_schema_schedule_timezone_'.$schema_id,
1513
+ 'type' => 'text',
1514
+ 'attributes' => array(
1515
+ 'placeholder' => 'Europe/London'
1516
+ ),
1517
+ ),
1518
  array(
1519
  'label' => 'Image',
1520
  'id' => 'saswp_event_schema_image_'.$schema_id,
1888
  'type' => 'text',
1889
  'default' => saswp_get_the_title()
1890
  ),
1891
+ array(
1892
+ 'label' => 'Description',
1893
+ 'id' => 'saswp_recipe_description_'.$schema_id,
1894
+ 'type' => 'textarea',
1895
+ 'default' => saswp_strip_all_tags(get_the_excerpt())
1896
+ ),
1897
  array(
1898
  'label' => 'Image',
1899
  'id' => 'saswp_recipe_image_'.$schema_id,
1910
  'id' => 'saswp_recipe_date_modified_'.$schema_id,
1911
  'type' => 'text',
1912
  'default' => get_the_modified_date("Y-m-d")
1913
+ ),
 
 
 
 
 
 
1914
  array(
1915
  'label' => 'Main Entity Id',
1916
  'id' => 'saswp_recipe_main_entity_'.$schema_id,
core/array-list/schemas.php CHANGED
@@ -14,6 +14,7 @@ return array(
14
  'Audiobook' => 'Audiobook',
15
  'BlogPosting' => 'BlogPosting',
16
  'Book' => 'Book',
 
17
  'Course' => 'Course',
18
  'CreativeWorkSeries' => 'CreativeWorkSeries',
19
  'DiscussionForumPosting' => 'DiscussionForumPosting',
@@ -37,7 +38,8 @@ return array(
37
  'SoftwareApplication' => 'SoftwareApplication',
38
  'SpecialAnnouncement' => 'SpecialAnnouncement',
39
  'MobileApplication' => 'MobileApplication',
40
- 'TechArticle' => 'TechArticle',
 
41
  'WebPage' => 'WebPage'
42
  ),
43
  'Event' => array(
14
  'Audiobook' => 'Audiobook',
15
  'BlogPosting' => 'BlogPosting',
16
  'Book' => 'Book',
17
+ 'CreativeWork' => 'CreativeWork',
18
  'Course' => 'Course',
19
  'CreativeWorkSeries' => 'CreativeWorkSeries',
20
  'DiscussionForumPosting' => 'DiscussionForumPosting',
38
  'SoftwareApplication' => 'SoftwareApplication',
39
  'SpecialAnnouncement' => 'SpecialAnnouncement',
40
  'MobileApplication' => 'MobileApplication',
41
+ 'TechArticle' => 'TechArticle',
42
+ 'VisualArtwork' => 'VisualArtwork',
43
  'WebPage' => 'WebPage'
44
  ),
45
  'Event' => array(
core/global.php CHANGED
@@ -42,6 +42,8 @@ $without_aggregate = array(
42
  'House',
43
  'SingleFamilyResidence',
44
  'Article',
 
 
45
  'BlogPosting',
46
  'Blogposting',
47
  'DiscussionForumPosting',
42
  'House',
43
  'SingleFamilyResidence',
44
  'Article',
45
+ 'CreativeWork',
46
+ 'VisualArtwork',
47
  'BlogPosting',
48
  'Blogposting',
49
  'DiscussionForumPosting',
modules/gutenberg/assets/blocks/book.js ADDED
@@ -0,0 +1,391 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ( function( blocks, element, editor, components, i18n) {
3
+
4
+ const el = element.createElement;
5
+ const { __ } = i18n;
6
+ const { RichText, MediaUpload } = editor;
7
+ const {Button} = components;
8
+
9
+ blocks.registerBlockType( 'saswp/book-block', {
10
+ title: __('Book (SASWP)', 'schema-and-structured-data-for-wp'),
11
+ icon: 'welcome-learn-more',
12
+ category: 'saswp-blocks',
13
+ keywords: ['schema', 'structured data', 'Book', 'book'],
14
+
15
+ supports: {
16
+ multiple: true
17
+ },
18
+
19
+ attributes: {
20
+ banner_id: {
21
+ type: 'integer'
22
+ },
23
+ banner_url: {
24
+ type: 'string'
25
+ },
26
+ title: {
27
+ type: 'string'
28
+ },
29
+ series: {
30
+ type: 'string'
31
+ },
32
+ author: {
33
+ type: 'string'
34
+ },
35
+ genre: {
36
+ type: 'string'
37
+ },
38
+ publisher: {
39
+ type: 'string'
40
+ },
41
+ release_date: {
42
+ type: 'string'
43
+ },
44
+ format: {
45
+ type: 'string'
46
+ },
47
+ pages: {
48
+ type: 'string'
49
+ },
50
+ source: {
51
+ type: 'string'
52
+ },
53
+ rating: {
54
+ type: 'string',
55
+ },
56
+ description: {
57
+ type: 'string'
58
+ }
59
+ },
60
+ edit: function( props ){
61
+
62
+ const attributes = props.attributes;
63
+ console.log(attributes);
64
+ function createRating(rating){
65
+ let element = [];
66
+ for(let i = 1; i <= 5; i++){
67
+
68
+ if(i <= rating){
69
+
70
+ element.push(el('span',{
71
+ 'data-id': i,
72
+ className: 'saswp-book-block-stars dashicons dashicons-star-filled',
73
+ onClick: function(e){
74
+ let current_id = e.target.getAttribute("data-id");
75
+ props.setAttributes( { rating: current_id} );
76
+ }
77
+ }));
78
+
79
+ }else{
80
+
81
+ element.push(el('span',{
82
+ 'data-id': i,
83
+ className: 'saswp-book-block-stars dashicons dashicons-star-empty',
84
+ onClick: function(e){
85
+ let current_id = e.target.getAttribute("data-id");
86
+ props.setAttributes( { rating: current_id} );
87
+ }
88
+ }));
89
+
90
+ }
91
+
92
+ }
93
+
94
+ return(
95
+ element
96
+ );
97
+ }
98
+
99
+ return (
100
+
101
+ el('div',{
102
+ className: 'saswp-book-block-container'
103
+ },
104
+ el('div',{
105
+ className: 'saswp-book-field-banner'
106
+ },
107
+
108
+ attributes.banner_url ?
109
+ el('div',{className:'saswp-book-banner-div'},
110
+ el('span',{
111
+ className:'dashicons dashicons-trash',
112
+ onClick: function(){
113
+ props.setAttributes( { banner_id: null, banner_url: '' } );
114
+ }
115
+ }),
116
+ el('img',{
117
+ src: attributes.banner_url,
118
+ })
119
+ )
120
+
121
+ :
122
+ el(
123
+ MediaUpload,{
124
+ onSelect: function(media){
125
+ props.setAttributes( { banner_id: media.id, banner_url: media.url } );
126
+ },
127
+ allowedTypes:[ "image" ],
128
+ value: attributes.banner_id,
129
+ render:function(obj){
130
+ return el( Button, {
131
+ className: 'button button-primary',
132
+ onClick: obj.open
133
+ },
134
+ __('Add Image', 'schema-and-structured-data-for-wp')
135
+ )
136
+ }
137
+ },
138
+ )
139
+
140
+ ),
141
+ el('div',{
142
+ className: 'saswp-book-field-container'
143
+ },
144
+
145
+ el('div', {
146
+ className: 'saswp-book-block-field',
147
+ },
148
+ el(
149
+ 'span', {
150
+ className: 'saswp-book-field-label'
151
+ },
152
+ __('Title : ', 'schema-and-structured-data-for-wp')
153
+ ),
154
+ el( RichText, {
155
+ tagName: 'p',
156
+ className:'saswp-book-field',
157
+ placeholder: __('Enter title', 'schema-and-structured-data-for-wp'),
158
+ value: attributes.title,
159
+ autoFocus: true,
160
+ onChange: function( newContent ) {
161
+ props.setAttributes( { title: newContent } );
162
+ }
163
+ }
164
+ )
165
+ ),
166
+
167
+ el('div', {
168
+ className: 'saswp-book-block-field',
169
+ },
170
+ el(
171
+ 'span', {
172
+ className: 'saswp-book-field-label'
173
+ },
174
+ __('Series : ', 'schema-and-structured-data-for-wp')
175
+ ),
176
+ el( RichText, {
177
+ tagName: 'p',
178
+ className:'saswp-book-field',
179
+ placeholder: __('Enter Series', 'schema-and-structured-data-for-wp'),
180
+ value: attributes.series,
181
+ autoFocus: true,
182
+ onChange: function( newContent ) {
183
+ props.setAttributes( { series: newContent } );
184
+ }
185
+ }
186
+ )
187
+ ),
188
+
189
+ el('div', {
190
+ className: 'saswp-book-block-field',
191
+ },
192
+ el(
193
+ 'span', {
194
+ className: 'saswp-book-field-label'
195
+ },
196
+ __('Author : ', 'schema-and-structured-data-for-wp')
197
+ ),
198
+ el( RichText, {
199
+ tagName: 'p',
200
+ className:'saswp-book-field',
201
+ placeholder: __('Enter Author', 'schema-and-structured-data-for-wp'),
202
+ value: attributes.author,
203
+ autoFocus: true,
204
+ onChange: function( newContent ) {
205
+ props.setAttributes( { author: newContent } );
206
+ }
207
+ }
208
+ )
209
+ ),
210
+
211
+
212
+ el('div', {
213
+ className: 'saswp-book-block-field',
214
+ },
215
+ el(
216
+ 'span', {
217
+ className: 'saswp-book-field-label'
218
+ },
219
+ __('Genre : ', 'schema-and-structured-data-for-wp')
220
+ ),
221
+ el( RichText, {
222
+ tagName: 'p',
223
+ className:'saswp-book-field',
224
+ placeholder: __('Enter Genre', 'schema-and-structured-data-for-wp'),
225
+ value: attributes.genre,
226
+ autoFocus: true,
227
+ onChange: function( newContent ) {
228
+ props.setAttributes( { genre: newContent } );
229
+ }
230
+ }
231
+ )
232
+ ),
233
+
234
+
235
+ el('div', {
236
+ className: 'saswp-book-block-field',
237
+ },
238
+ el(
239
+ 'span', {
240
+ className: 'saswp-book-field-label'
241
+ },
242
+ __('Publisher : ', 'schema-and-structured-data-for-wp')
243
+ ),
244
+ el( RichText, {
245
+ tagName: 'p',
246
+ className:'saswp-book-field',
247
+ placeholder: __('Enter Publisher', 'schema-and-structured-data-for-wp'),
248
+ value: attributes.publisher,
249
+ autoFocus: true,
250
+ onChange: function( newContent ) {
251
+ props.setAttributes( { publisher: newContent } );
252
+ }
253
+ }
254
+ )
255
+ ),
256
+
257
+
258
+ el('div', {
259
+ className: 'saswp-book-block-field',
260
+ },
261
+ el(
262
+ 'span', {
263
+ className: 'saswp-book-field-label'
264
+ },
265
+ __('Release Date : ', 'schema-and-structured-data-for-wp')
266
+ ),
267
+ el( RichText, {
268
+ tagName: 'p',
269
+ className:'saswp-book-field',
270
+ placeholder: __('Enter Release Date', 'schema-and-structured-data-for-wp'),
271
+ value: attributes.release_date,
272
+ autoFocus: true,
273
+ onChange: function( newContent ) {
274
+ props.setAttributes( { release_date: newContent } );
275
+ }
276
+ }
277
+ )
278
+ ),
279
+
280
+
281
+ el('div', {
282
+ className: 'saswp-book-block-field',
283
+ },
284
+ el(
285
+ 'span', {
286
+ className: 'saswp-book-field-label'
287
+ },
288
+ __('Format : ', 'schema-and-structured-data-for-wp')
289
+ ),
290
+ el( RichText, {
291
+ tagName: 'p',
292
+ className:'saswp-book-field',
293
+ placeholder: __('Enter Format', 'schema-and-structured-data-for-wp'),
294
+ value: attributes.format,
295
+ autoFocus: true,
296
+ onChange: function( newContent ) {
297
+ props.setAttributes( { format: newContent } );
298
+ }
299
+ }
300
+ )
301
+ ),
302
+
303
+
304
+ el('div', {
305
+ className: 'saswp-book-block-field',
306
+ },
307
+ el(
308
+ 'span', {
309
+ className: 'saswp-book-field-label'
310
+ },
311
+ __('Pages : ', 'schema-and-structured-data-for-wp')
312
+ ),
313
+ el( RichText, {
314
+ tagName: 'p',
315
+ className:'saswp-book-field',
316
+ placeholder: __('Enter Pages', 'schema-and-structured-data-for-wp'),
317
+ value: attributes.pages,
318
+ autoFocus: true,
319
+ onChange: function( newContent ) {
320
+ props.setAttributes( { pages: newContent } );
321
+ }
322
+ }
323
+ )
324
+ ),
325
+
326
+ el('div', {
327
+ className: 'saswp-book-block-field',
328
+ },
329
+ el(
330
+ 'span', {
331
+ className: 'saswp-book-field-label'
332
+ },
333
+ __('Source : ', 'schema-and-structured-data-for-wp')
334
+ ),
335
+ el( RichText, {
336
+ tagName: 'p',
337
+ className:'saswp-book-field',
338
+ placeholder: __('Enter Source', 'schema-and-structured-data-for-wp'),
339
+ value: attributes.source,
340
+ autoFocus: true,
341
+ onChange: function( newContent ) {
342
+ props.setAttributes( { source: newContent } );
343
+ }
344
+ }
345
+ )
346
+ ),
347
+
348
+ el('div', {
349
+ className: 'saswp-book-block-field',
350
+ },
351
+ el(
352
+ 'span', {
353
+ className: 'saswp-book-field-label'
354
+ },
355
+ __('Rating : ', 'schema-and-structured-data-for-wp')
356
+ ),
357
+ createRating(attributes.rating)
358
+ ),
359
+
360
+ el('div', {
361
+ className: 'saswp-book-block-field',
362
+ },
363
+ el( RichText, {
364
+ tagName: 'p',
365
+ className:'saswp-book-field',
366
+ placeholder: __('Enter Description', 'schema-and-structured-data-for-wp'),
367
+ value: attributes.description,
368
+ autoFocus: true,
369
+ onChange: function( newContent ) {
370
+ props.setAttributes( { description: newContent } );
371
+ }
372
+ }
373
+ )
374
+ )
375
+ ),
376
+ )
377
+ );
378
+
379
+ },
380
+ save: function( props ) {
381
+ return null
382
+ }
383
+ });
384
+ }(
385
+ window.wp.blocks,
386
+ window.wp.element,
387
+ window.wp.blockEditor,
388
+ window.wp.components,
389
+ window.wp.i18n,
390
+ ) );
391
+
modules/gutenberg/assets/css/amp/book.css ADDED
File without changes
modules/gutenberg/assets/css/book.css ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .saswp-book-field-label{
2
+ font-weight: 700;
3
+ }
4
+ .saswp-book-field{
5
+ display: inline;
6
+ }
7
+ .saswp-book-field-banner{
8
+ height: 200px;
9
+ width: 200px;
10
+ text-align: center;
11
+ display: flex;
12
+ justify-content: center;
13
+ align-items: center;
14
+ }
15
+
16
+ .saswp-book-block-stars::before{
17
+ color: #eba845 !important;
18
+ }
19
+ .saswp-book-block-stars{
20
+ margin-top: 10px;
21
+ }
22
+ .saswp-book-banner-div{
23
+ position: relative;
24
+ }
25
+ .saswp-book-field-banner{
26
+ float: left;
27
+ margin-right: 15px;
28
+ margin-bottom: 15px;
29
+ }
modules/gutenberg/assets/css/editor.css CHANGED
@@ -7,7 +7,44 @@ and open the template in the editor.
7
  Created on : Sep 15, 2019, 1:52:02 PM
8
  Author : acer
9
  */
10
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  .saswp-faq-question-id .components-base-control__field{
12
  margin-bottom: auto;
13
  }
7
  Created on : Sep 15, 2019, 1:52:02 PM
8
  Author : acer
9
  */
10
+ .saswp-book-field-label{
11
+ font-weight: 700;
12
+ }
13
+ .saswp-book-field{
14
+ display: inline;
15
+ }
16
+ .saswp-book-field-banner{
17
+ height: 200px;
18
+ width: 200px;
19
+ background: #ccc;
20
+ text-align: center;
21
+ display: flex;
22
+ justify-content: center;
23
+ align-items: center;
24
+ }
25
+ .saswp-book-block-stars{
26
+ cursor: pointer;
27
+ }
28
+ .saswp-book-block-stars::before{
29
+ color: #eba845 !important;
30
+ }
31
+ .saswp-book-block-stars{
32
+ margin-top: 10px;
33
+ }
34
+ .saswp-book-banner-div{
35
+ position: relative;
36
+ }
37
+ .saswp-book-field-banner{
38
+ float: left;
39
+ margin-right: 15px;
40
+ margin-bottom: 15px;
41
+ }
42
+ .saswp-book-banner-div span{
43
+ position: absolute;
44
+ right: 0px;
45
+ background: #fff;
46
+ cursor: pointer;
47
+ }
48
  .saswp-faq-question-id .components-base-control__field{
49
  margin-bottom: auto;
50
  }
modules/gutenberg/includes/class-gutenberg.php CHANGED
@@ -31,6 +31,15 @@ class SASWP_Gutenberg {
31
  'editor' => 'saswp-gutenberg-css-reg-editor',
32
  'local' => array()
33
  ),
 
 
 
 
 
 
 
 
 
34
  'course' => array(
35
  'handler' => 'saswp-course-js-reg',
36
  'local_var' => 'saswpGutenbergCourse',
@@ -140,6 +149,10 @@ class SASWP_Gutenberg {
140
  $amp_css = SASWP_PLUGIN_DIR_PATH . 'modules/gutenberg/assets/css/amp/course.css';
141
  echo @file_get_contents($amp_css);
142
  }
 
 
 
 
143
 
144
  }
145
 
@@ -200,6 +213,16 @@ class SASWP_Gutenberg {
200
 
201
  }
202
 
 
 
 
 
 
 
 
 
 
 
203
  }
204
 
205
  }
@@ -297,6 +320,21 @@ class SASWP_Gutenberg {
297
 
298
  }
299
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  public function render_course_data($attributes){
301
 
302
  ob_start();
@@ -624,4 +662,4 @@ class SASWP_Gutenberg {
624
 
625
  if ( class_exists( 'SASWP_Gutenberg') ) {
626
  SASWP_Gutenberg::get_instance();
627
- }
31
  'editor' => 'saswp-gutenberg-css-reg-editor',
32
  'local' => array()
33
  ),
34
+ 'book' => array(
35
+ 'handler' => 'saswp-book-js-reg',
36
+ 'local_var' => 'saswpGutenbergBook',
37
+ 'block_name' => 'book-block',
38
+ 'render_func' => 'render_book_data',
39
+ 'style' => 'saswp-g-book-css',
40
+ 'editor' => 'saswp-gutenberg-css-reg-editor',
41
+ 'local' => array()
42
+ ),
43
  'course' => array(
44
  'handler' => 'saswp-course-js-reg',
45
  'local_var' => 'saswpGutenbergCourse',
149
  $amp_css = SASWP_PLUGIN_DIR_PATH . 'modules/gutenberg/assets/css/amp/course.css';
150
  echo @file_get_contents($amp_css);
151
  }
152
+ if(isset($parse_blocks['blockName']) && $parse_blocks['blockName'] === 'saswp/book-block'){
153
+ $amp_css = SASWP_PLUGIN_DIR_PATH . 'modules/gutenberg/assets/css/amp/book.css';
154
+ echo @file_get_contents($amp_css);
155
+ }
156
 
157
  }
158
 
213
 
214
  }
215
 
216
+ if(isset($parse_blocks['blockName']) && $parse_blocks['blockName'] === 'saswp/book-block'){
217
+
218
+ wp_enqueue_style(
219
+ 'saswp-g-book-css',
220
+ SASWP_PLUGIN_URL . '/modules/gutenberg/assets/css/book.css',
221
+ array()
222
+ );
223
+
224
+ }
225
+
226
  }
227
 
228
  }
320
 
321
  }
322
 
323
+ public function render_book_data($attributes){
324
+
325
+ ob_start();
326
+
327
+ if ( !isset( $attributes ) ) {
328
+ ob_end_clean();
329
+ return '';
330
+ }
331
+
332
+ echo $this->render->book_block_data($attributes);
333
+
334
+ return ob_get_clean();
335
+
336
+ }
337
+
338
  public function render_course_data($attributes){
339
 
340
  ob_start();
662
 
663
  if ( class_exists( 'SASWP_Gutenberg') ) {
664
  SASWP_Gutenberg::get_instance();
665
+ }
modules/gutenberg/includes/render.php CHANGED
@@ -210,7 +210,91 @@ class SASWP_Gutenberg_Render {
210
 
211
  return $response;
212
  }
213
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  public function course_block_data($attributes){
215
 
216
  $response = '';
210
 
211
  return $response;
212
  }
213
+ public function book_block_data($attributes){
214
+
215
+ ?>
216
+ <div class="saswp-book-block-container">
217
+ <div class="saswp-book-field-banner">
218
+ <div class="saswp-book-banner-div">
219
+ <img src="<?php echo esc_url($attributes['banner_url']) ?>" />
220
+ </div>
221
+ </div>
222
+ <div class="saswp-book-field-container">
223
+
224
+ <div class="saswp-book-block-field">
225
+ <span class="saswp-book-field-label"><?php echo saswp_t_string('Title'); ?> : </span>
226
+ <div class="saswp-book-field"><?php echo (!empty($attributes['title']) ? esc_html($attributes['title']) : '' ) ?></div>
227
+ </div>
228
+
229
+ <div class="saswp-book-block-field">
230
+ <span class="saswp-book-field-label"><?php echo saswp_t_string('Series'); ?> : </span>
231
+ <div class="saswp-book-field"><?php echo (!empty($attributes['series']) ? esc_html($attributes['series']) : '' ) ?></div>
232
+ </div>
233
+
234
+ <div class="saswp-book-block-field">
235
+ <span class="saswp-book-field-label"><?php echo saswp_t_string('Author'); ?> : </span>
236
+ <div class="saswp-book-field"><?php echo (!empty($attributes['author']) ? esc_html($attributes['author']) : '' ) ?></div>
237
+ </div>
238
+
239
+ <div class="saswp-book-block-field">
240
+ <span class="saswp-book-field-label"><?php echo saswp_t_string('Genre'); ?> : </span>
241
+ <div class="saswp-book-field"><?php echo (!empty($attributes['genre']) ? esc_html($attributes['genre']) : '' ) ?></div>
242
+ </div>
243
+
244
+ <div class="saswp-book-block-field">
245
+ <span class="saswp-book-field-label"><?php echo saswp_t_string('Publisher'); ?> : </span>
246
+ <div class="saswp-book-field"><?php echo (!empty($attributes['publisher']) ? esc_html($attributes['publisher']) : '' ) ?></div>
247
+ </div>
248
+
249
+ <div class="saswp-book-block-field">
250
+ <span class="saswp-book-field-label"><?php echo saswp_t_string('Release Date'); ?> : </span>
251
+ <div class="saswp-book-field"><?php echo (!empty($attributes['release_date']) ? esc_html($attributes['release_date']) : '' ) ?></div>
252
+ </div>
253
+
254
+ <div class="saswp-book-block-field">
255
+ <span class="saswp-book-field-label"><?php echo saswp_t_string('Format'); ?> : </span>
256
+ <div class="saswp-book-field"><?php echo (!empty($attributes['format']) ? esc_html($attributes['format']) : '' ) ?></div>
257
+ </div>
258
+
259
+ <div class="saswp-book-block-field">
260
+ <span class="saswp-book-field-label"><?php echo saswp_t_string('Pages'); ?> : </span>
261
+ <div class="saswp-book-field"><?php echo (!empty($attributes['pages']) ? esc_html($attributes['pages']) : '' ) ?></div>
262
+ </div>
263
+
264
+ <div class="saswp-book-block-field">
265
+ <span class="saswp-book-field-label"><?php echo saswp_t_string('Source'); ?> : </span>
266
+ <div class="saswp-book-field"><?php echo (!empty($attributes['source']) ? esc_html($attributes['source']) : '' ) ?></div>
267
+ </div>
268
+
269
+ <div class="saswp-book-block-field">
270
+ <span class="saswp-book-field-label"><?php echo saswp_t_string('Rating'); ?> : </span>
271
+ <div class="saswp-book-field">
272
+ <?php
273
+ if(isset($attributes['rating'])){
274
+ for($i = 1; $i <= 5; $i++){
275
+
276
+ if($i <= $attributes['rating']){
277
+ echo '<span class="saswp-book-block-stars dashicons dashicons-star-filled"></span>';
278
+ }else{
279
+ echo '<span class="saswp-book-block-stars dashicons dashicons-star-empty"></span>';
280
+ }
281
+
282
+ }
283
+ }
284
+
285
+ ?>
286
+ </div>
287
+ </div>
288
+
289
+ <div class="saswp-book-block-field">
290
+ <p><?php echo (!empty($attributes['description']) ? esc_html($attributes['description']) : '' ) ?></p>
291
+ </div>
292
+
293
+ </div>
294
+ </div>
295
+ <?php
296
+
297
+ }
298
  public function course_block_data($attributes){
299
 
300
  $response = '';
output/function.php CHANGED
@@ -204,6 +204,7 @@ function saswp_get_all_schema_markup_output() {
204
  $divi_builder_faq = array();
205
  $gutenberg_event = array();
206
  $gutenberg_job = array();
 
207
  $gutenberg_course = array();
208
 
209
  if( !is_home() && ( is_singular() || is_front_page() || (function_exists('ampforwp_is_front_page') && ampforwp_is_front_page())) ){
@@ -215,6 +216,7 @@ function saswp_get_all_schema_markup_output() {
215
  $gutenberg_event = saswp_gutenberg_event_schema();
216
  $gutenberg_qanda = saswp_gutenberg_qanda_schema();
217
  $gutenberg_job = saswp_gutenberg_job_schema();
 
218
  $gutenberg_course = saswp_gutenberg_course_schema();
219
  $gutenberg_how_to = saswp_gutenberg_how_to_schema();
220
  $gutenberg_recipe = saswp_gutenberg_recipe_schema();
@@ -406,6 +408,12 @@ function saswp_get_all_schema_markup_output() {
406
  $output .= ",";
407
  $output .= "\n\n";
408
  }
 
 
 
 
 
 
409
  if(!empty($collection_output)){
410
 
411
  $output .= saswp_json_print_format($collection_output);
204
  $divi_builder_faq = array();
205
  $gutenberg_event = array();
206
  $gutenberg_job = array();
207
+ $gutenberg_book = array();
208
  $gutenberg_course = array();
209
 
210
  if( !is_home() && ( is_singular() || is_front_page() || (function_exists('ampforwp_is_front_page') && ampforwp_is_front_page())) ){
216
  $gutenberg_event = saswp_gutenberg_event_schema();
217
  $gutenberg_qanda = saswp_gutenberg_qanda_schema();
218
  $gutenberg_job = saswp_gutenberg_job_schema();
219
+ $gutenberg_book = saswp_gutenberg_book_schema();
220
  $gutenberg_course = saswp_gutenberg_course_schema();
221
  $gutenberg_how_to = saswp_gutenberg_how_to_schema();
222
  $gutenberg_recipe = saswp_gutenberg_recipe_schema();
408
  $output .= ",";
409
  $output .= "\n\n";
410
  }
411
+ if(!empty($gutenberg_book)){
412
+
413
+ $output .= saswp_json_print_format($gutenberg_book);
414
+ $output .= ",";
415
+ $output .= "\n\n";
416
+ }
417
  if(!empty($collection_output)){
418
 
419
  $output .= saswp_json_print_format($collection_output);
output/gutenberg.php CHANGED
@@ -982,6 +982,55 @@ function saswp_gutenberg_qanda_schema(){
982
 
983
  }
984
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
985
  function saswp_gutenberg_job_schema(){
986
 
987
  $input1 = array();
982
 
983
  }
984
 
985
+ function saswp_gutenberg_book_schema(){
986
+
987
+ $input1 = array();
988
+
989
+ $attributes = saswp_get_gutenberg_block_data('saswp/book-block');
990
+
991
+ if(isset($attributes['attrs'])){
992
+
993
+ $data = $attributes['attrs'];
994
+
995
+ $input1['@context'] = saswp_context_url();
996
+ $input1['@type'] = 'Book';
997
+ $input1['@id'] = trailingslashit(saswp_get_permalink()).'#Book';
998
+ $input1['name'] = $data['title'] ? $data['title'] : saswp_get_the_title();
999
+
1000
+ if(!empty($data['description'])){
1001
+ $input1['description'] = wp_strip_all_tags($data['description']);
1002
+ }
1003
+
1004
+ if(!empty($data['release_date'])){
1005
+ $input1['datePublished'] = saswp_format_date_time($data['release_date']);
1006
+ }
1007
+ if(!empty($data['author'])){
1008
+ $input1['author']['@type'] = 'Person';
1009
+ $input1['author']['name'] = $data['author'];
1010
+ }
1011
+ if(!empty($data['publisher'])){
1012
+ $input1['publisher']['@type'] = 'Organization';
1013
+ $input1['publisher']['name'] = $data['publisher'];
1014
+ }
1015
+ if(!empty($data['pages'])){
1016
+ $input1['numberOfPages'] = $data['pages'];
1017
+ }
1018
+ if(!empty($data['format'])){
1019
+ $input1['bookFormat'] = $data['format'];
1020
+ }
1021
+ if(!empty($data['genre'])){
1022
+ $input1['genre'] = $data['genre'];
1023
+ }
1024
+ if(!empty($data['rating'])){
1025
+ $input1['aggregateRating']['@type'] = 'AggregateRating';
1026
+ $input1['aggregateRating']['ratingValue'] = $data['rating'];
1027
+ $input1['aggregateRating']['reviewCount'] = 1;
1028
+ }
1029
+ }
1030
+
1031
+ return $input1;
1032
+ }
1033
+
1034
  function saswp_gutenberg_job_schema(){
1035
 
1036
  $input1 = array();
output/markup.php CHANGED
@@ -351,10 +351,10 @@ function saswp_event_schema_markup($schema_id, $schema_post_id, $all_post_meta){
351
  $input1 = array();
352
 
353
  $input1 = array(
354
- '@context' => saswp_context_url(),
355
- '@type' => (isset($all_post_meta['saswp_event_schema_type_'.$schema_id][0]) && $all_post_meta['saswp_event_schema_type_'.$schema_id][0] !='') ? $all_post_meta['saswp_event_schema_type_'.$schema_id][0] : 'Event' ,
356
- 'name' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_name_'.$schema_id, 'saswp_array'),
357
- 'description' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_description_'.$schema_id, 'saswp_array')
358
  );
359
 
360
  $input1 = saswp_get_modified_image('saswp_event_schema_image_'.$schema_id.'_detail', $input1);
@@ -440,33 +440,52 @@ function saswp_event_schema_markup($schema_id, $schema_post_id, $all_post_meta){
440
  $input1['previousStartDate'] = saswp_format_date_time($date, $time);
441
 
442
  }
443
-
 
444
  if(isset($all_post_meta['saswp_event_schema_start_date_'.$schema_id][0])){
445
-
446
- $date = $time = '';
447
-
448
- $date = $all_post_meta['saswp_event_schema_start_date_'.$schema_id][0];
449
 
450
  if(isset($all_post_meta['saswp_event_schema_start_time_'.$schema_id][0])){
451
- $time = $all_post_meta['saswp_event_schema_start_time_'.$schema_id][0];
452
  }
453
-
454
- $input1['startDate'] = saswp_format_date_time($date, $time);
455
 
456
  }
457
-
 
458
  if(isset($all_post_meta['saswp_event_schema_end_date_'.$schema_id][0])){
459
-
460
- $date = $time = '';
461
-
462
- $date = $all_post_meta['saswp_event_schema_end_date_'.$schema_id][0];
463
 
464
  if(isset($all_post_meta['saswp_event_schema_end_time_'.$schema_id][0])){
465
- $time = $all_post_meta['saswp_event_schema_end_time_'.$schema_id][0];
466
  }
467
 
468
- $input1['endDate'] = saswp_format_date_time($date, $time);
469
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
470
  }
471
 
472
  //Performer starts here
@@ -696,7 +715,8 @@ function saswp_recipe_schema_markup($schema_id, $schema_post_id, $all_post_meta)
696
  '@type' => 'Recipe' ,
697
  '@id' => trailingslashit(get_permalink()).'#recipe',
698
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_url_'.$schema_id, 'saswp_array'),
699
- 'name' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_name_'.$schema_id, 'saswp_array'),
 
700
  'prepTime' => saswp_format_time_to_ISO_8601(saswp_remove_warnings($all_post_meta, 'saswp_recipe_preptime_'.$schema_id, 'saswp_array')),
701
  'cookTime' => saswp_format_time_to_ISO_8601(saswp_remove_warnings($all_post_meta, 'saswp_recipe_cooktime_'.$schema_id, 'saswp_array')),
702
  'totalTime' => saswp_format_time_to_ISO_8601(saswp_remove_warnings($all_post_meta, 'saswp_recipe_totaltime_'.$schema_id, 'saswp_array')),
@@ -707,8 +727,7 @@ function saswp_recipe_schema_markup($schema_id, $schema_post_id, $all_post_meta)
707
  'recipeIngredient' => $ingredient,
708
  'recipeInstructions' => $instruction,
709
  'datePublished' => isset($all_post_meta['saswp_recipe_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_recipe_date_published_'.$schema_id][0])):'',
710
- 'dateModified' => isset($all_post_meta['saswp_recipe_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_recipe_date_modified_'.$schema_id][0])):'',
711
- 'description' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_description_'.$schema_id, 'saswp_array'),
712
  'mainEntity' => array(
713
  '@type' => 'WebPage',
714
  '@id' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_main_entity_'.$schema_id, 'saswp_array'),
@@ -3370,8 +3389,7 @@ function saswp_webpage_schema_markup($schema_id, $schema_post_id, $all_post_meta
3370
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_headline_'.$schema_id, 'saswp_array'),
3371
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_description_'.$schema_id, 'saswp_array'),
3372
  'keywords' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_keywords_'.$schema_id, 'saswp_array'),
3373
- 'articleSection' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_section_'.$schema_id, 'saswp_array'),
3374
- 'articleBody' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_body_'.$schema_id, 'saswp_array'),
3375
  'datePublished' => isset($all_post_meta['saswp_webpage_date_published_'.$schema_id])? saswp_format_date_time($all_post_meta['saswp_webpage_date_published_'.$schema_id][0], get_post_time('h:i:s')) :'',
3376
  'dateModified' => isset($all_post_meta['saswp_webpage_date_modified_'.$schema_id])? saswp_format_date_time($all_post_meta['saswp_webpage_date_modified_'.$schema_id][0], get_the_modified_time('h:i:s')) :'',
3377
  'publisher' => array(
@@ -3533,6 +3551,52 @@ function saswp_special_announcement_schema_markup($schema_id, $schema_post_id, $
3533
 
3534
  }
3535
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3536
  function saswp_photograph_schema_markup($schema_id, $schema_post_id, $all_post_meta){
3537
 
3538
  $input1 = array();
@@ -3654,6 +3718,72 @@ function saswp_article_schema_markup($schema_id, $schema_post_id, $all_post_meta
3654
 
3655
  }
3656
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3657
  function saswp_tech_article_schema_markup($schema_id, $schema_post_id, $all_post_meta){
3658
 
3659
  $input1 = array();
351
  $input1 = array();
352
 
353
  $input1 = array(
354
+ '@context' => saswp_context_url(),
355
+ '@type' => (isset($all_post_meta['saswp_event_schema_type_'.$schema_id][0]) && $all_post_meta['saswp_event_schema_type_'.$schema_id][0] !='') ? $all_post_meta['saswp_event_schema_type_'.$schema_id][0] : 'Event' ,
356
+ 'name' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_name_'.$schema_id, 'saswp_array'),
357
+ 'description' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_description_'.$schema_id, 'saswp_array')
358
  );
359
 
360
  $input1 = saswp_get_modified_image('saswp_event_schema_image_'.$schema_id.'_detail', $input1);
440
  $input1['previousStartDate'] = saswp_format_date_time($date, $time);
441
 
442
  }
443
+ $start_date = '';
444
+ $start_time = '';
445
  if(isset($all_post_meta['saswp_event_schema_start_date_'.$schema_id][0])){
446
+
447
+ $start_date = $all_post_meta['saswp_event_schema_start_date_'.$schema_id][0];
 
 
448
 
449
  if(isset($all_post_meta['saswp_event_schema_start_time_'.$schema_id][0])){
450
+ $start_time = $all_post_meta['saswp_event_schema_start_time_'.$schema_id][0];
451
  }
452
+
453
+ $input1['startDate'] = saswp_format_date_time($start_date, $start_time);
454
 
455
  }
456
+ $end_date = '';
457
+ $end_time = '';
458
  if(isset($all_post_meta['saswp_event_schema_end_date_'.$schema_id][0])){
459
+
460
+ $end_date = $all_post_meta['saswp_event_schema_end_date_'.$schema_id][0];
 
 
461
 
462
  if(isset($all_post_meta['saswp_event_schema_end_time_'.$schema_id][0])){
463
+ $end_time = $all_post_meta['saswp_event_schema_end_time_'.$schema_id][0];
464
  }
465
 
466
+ $input1['endDate'] = saswp_format_date_time($end_date, $end_time);
467
 
468
+ }
469
+
470
+ if(!empty($all_post_meta['saswp_event_schema_schedule_repeat_frequency_'.$schema_id][0])){
471
+
472
+ $input1['eventSchedule']['@type'] = 'Schedule';
473
+ $input1['eventSchedule']['startDate'] = $start_date;
474
+ $input1['eventSchedule']['endDate'] = $end_date;
475
+ $input1['eventSchedule']['startTime'] = $start_time;
476
+ $input1['eventSchedule']['endTime'] = $end_time;
477
+ $input1['eventSchedule']['repeatFrequency'] = $all_post_meta['saswp_event_schema_schedule_repeat_frequency_'.$schema_id][0];
478
+
479
+ if(!empty($all_post_meta['saswp_event_schema_schedule_by_day_'.$schema_id][0])){
480
+ $input1['eventSchedule']['byDay'] = explode(',', $all_post_meta['saswp_event_schema_schedule_by_day_'.$schema_id][0]);
481
+ }
482
+ if(!empty($all_post_meta['saswp_event_schema_schedule_timezone_'.$schema_id][0])){
483
+ $input1['eventSchedule']['scheduleTimezone'] = $all_post_meta['saswp_event_schema_schedule_timezone_'.$schema_id][0];
484
+ }
485
+ if(!empty($all_post_meta['saswp_event_schema_schedule_by_month_day_'.$schema_id][0])){
486
+ $input1['eventSchedule']['byMonthDay'] = explode(',', $all_post_meta['saswp_event_schema_schedule_by_month_day_'.$schema_id][0]);
487
+ }
488
+
489
  }
490
 
491
  //Performer starts here
715
  '@type' => 'Recipe' ,
716
  '@id' => trailingslashit(get_permalink()).'#recipe',
717
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_url_'.$schema_id, 'saswp_array'),
718
+ 'name' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_name_'.$schema_id, 'saswp_array'),
719
+ 'description' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_description_'.$schema_id, 'saswp_array'),
720
  'prepTime' => saswp_format_time_to_ISO_8601(saswp_remove_warnings($all_post_meta, 'saswp_recipe_preptime_'.$schema_id, 'saswp_array')),
721
  'cookTime' => saswp_format_time_to_ISO_8601(saswp_remove_warnings($all_post_meta, 'saswp_recipe_cooktime_'.$schema_id, 'saswp_array')),
722
  'totalTime' => saswp_format_time_to_ISO_8601(saswp_remove_warnings($all_post_meta, 'saswp_recipe_totaltime_'.$schema_id, 'saswp_array')),
727
  'recipeIngredient' => $ingredient,
728
  'recipeInstructions' => $instruction,
729
  'datePublished' => isset($all_post_meta['saswp_recipe_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_recipe_date_published_'.$schema_id][0])):'',
730
+ 'dateModified' => isset($all_post_meta['saswp_recipe_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_recipe_date_modified_'.$schema_id][0])):'',
 
731
  'mainEntity' => array(
732
  '@type' => 'WebPage',
733
  '@id' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_main_entity_'.$schema_id, 'saswp_array'),
3389
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_headline_'.$schema_id, 'saswp_array'),
3390
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_description_'.$schema_id, 'saswp_array'),
3391
  'keywords' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_keywords_'.$schema_id, 'saswp_array'),
3392
+ 'articleSection' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_section_'.$schema_id, 'saswp_array'),
 
3393
  'datePublished' => isset($all_post_meta['saswp_webpage_date_published_'.$schema_id])? saswp_format_date_time($all_post_meta['saswp_webpage_date_published_'.$schema_id][0], get_post_time('h:i:s')) :'',
3394
  'dateModified' => isset($all_post_meta['saswp_webpage_date_modified_'.$schema_id])? saswp_format_date_time($all_post_meta['saswp_webpage_date_modified_'.$schema_id][0], get_the_modified_time('h:i:s')) :'',
3395
  'publisher' => array(
3551
 
3552
  }
3553
 
3554
+ function saswp_visualartwork_schema_markup($schema_id, $schema_post_id, $all_post_meta){
3555
+
3556
+ $input1 = array();
3557
+
3558
+ $input1 = array(
3559
+ '@context' => saswp_context_url(),
3560
+ '@type' => 'VisualArtwork',
3561
+ '@id' => trailingslashit(get_permalink()).'#VisualArtwork',
3562
+ 'url' => saswp_remove_warnings($all_post_meta, 'saswp_visualartwork_url_'.$schema_id, 'saswp_array'),
3563
+ 'image' => saswp_remove_warnings($all_post_meta, 'saswp_visualartwork_image'.$schema_id, 'saswp_array'),
3564
+ 'name' => saswp_remove_warnings($all_post_meta, 'saswp_visualartwork_name_'.$schema_id, 'saswp_array'),
3565
+ 'alternateName' => saswp_remove_warnings($all_post_meta, 'saswp_visualartwork_alternate_name_'.$schema_id, 'saswp_array'),
3566
+ 'description' => saswp_remove_warnings($all_post_meta, 'saswp_visualartwork_description_'.$schema_id, 'saswp_array'),
3567
+ 'dateCreated' => isset($all_post_meta['saswp_visualartwork_date_created_'.$schema_id][0])? saswp_format_date_time($all_post_meta['saswp_visualartwork_date_created_'.$schema_id][0], get_post_time('h:i:s')):'',
3568
+ 'artform' => saswp_remove_warnings($all_post_meta, 'saswp_visualartwork_artform_'.$schema_id, 'saswp_array'),
3569
+ 'artEdition' => saswp_remove_warnings($all_post_meta, 'saswp_visualartwork_artedition_'.$schema_id, 'saswp_array'),
3570
+ 'artworkSurface' => saswp_remove_warnings($all_post_meta, 'saswp_visualartwork_artwork_surface_'.$schema_id, 'saswp_array'),
3571
+
3572
+ );
3573
+
3574
+ if(isset( $all_post_meta['saswp_visualartwork_artmedium_'.$schema_id][0] )){
3575
+ $input1['artMedium'] = explode(',', $all_post_meta['saswp_visualartwork_artmedium_'.$schema_id][0]);
3576
+ }
3577
+ if(isset( $all_post_meta['saswp_visualartwork_width_'.$schema_id][0] )){
3578
+ $input1['width']['@type'] = 'Distance';
3579
+ $input1['width']['name'] = $all_post_meta['saswp_visualartwork_width_'.$schema_id][0];
3580
+ }
3581
+ if(isset( $all_post_meta['saswp_visualartwork_height_'.$schema_id][0] )){
3582
+ $input1['height']['@type'] = 'Distance';
3583
+ $input1['height']['name'] = $all_post_meta['saswp_visualartwork_height_'.$schema_id][0];
3584
+ }
3585
+
3586
+ $input1['creator']['@type'] = 'Person';
3587
+
3588
+ if(isset( $all_post_meta['saswp_photograph_author_type_'.$schema_id][0] )){
3589
+ $input1['creator']['@type'] = $all_post_meta['saswp_photograph_author_type_'.$schema_id][0];
3590
+ }
3591
+
3592
+ $input1['creator']['name'] = saswp_remove_warnings($all_post_meta, 'saswp_photograph_author_name_'.$schema_id, 'saswp_array');
3593
+ $input1['creator']['description'] = saswp_remove_warnings($all_post_meta, 'saswp_photograph_author_description_'.$schema_id, 'saswp_array');
3594
+ $input1['creator']['url'] = saswp_remove_warnings($all_post_meta, 'saswp_photograph_author_url_'.$schema_id, 'saswp_array');
3595
+
3596
+ return $input1;
3597
+
3598
+ }
3599
+
3600
  function saswp_photograph_schema_markup($schema_id, $schema_post_id, $all_post_meta){
3601
 
3602
  $input1 = array();
3718
 
3719
  }
3720
 
3721
+ function saswp_creativework_schema_markup($schema_id, $schema_post_id, $all_post_meta){
3722
+
3723
+ $input1 = array();
3724
+
3725
+ $slogo = get_post_meta( get_the_ID(), 'saswp_creativework_organization_logo_'.$schema_id.'_detail',true);
3726
+
3727
+ $input1 = array(
3728
+ '@context' => saswp_context_url(),
3729
+ '@type' => 'CreativeWork',
3730
+ '@id' => trailingslashit(get_permalink()).'#CreativeWork',
3731
+ 'url' => saswp_remove_warnings($all_post_meta, 'saswp_creativework_url_'.$schema_id, 'saswp_array'),
3732
+ 'inLanguage' => saswp_remove_warnings($all_post_meta, 'saswp_creativework_inlanguage_'.$schema_id, 'saswp_array'),
3733
+ 'mainEntityOfPage' => saswp_remove_warnings($all_post_meta, 'saswp_creativework_main_entity_of_page_'.$schema_id, 'saswp_array'),
3734
+ 'image' => saswp_remove_warnings($all_post_meta, 'saswp_creativework_image_'.$schema_id, 'saswp_array'),
3735
+ 'headline' => saswp_remove_warnings($all_post_meta, 'saswp_creativework_headline_'.$schema_id, 'saswp_array'),
3736
+ 'description' => saswp_remove_warnings($all_post_meta, 'saswp_creativework_description_'.$schema_id, 'saswp_array'),
3737
+ 'articleSection' => saswp_remove_warnings($all_post_meta, 'saswp_creativework_section_'.$schema_id, 'saswp_array'),
3738
+ 'articleBody' => isset($all_post_meta['saswp_creativework_body_'.$schema_id][0]) ? wp_strip_all_tags(strip_shortcodes($all_post_meta['saswp_creativework_body_'.$schema_id][0])) : '',
3739
+ 'keywords' => saswp_remove_warnings($all_post_meta, 'saswp_creativework_keywords_'.$schema_id, 'saswp_array'),
3740
+ 'datePublished' => isset($all_post_meta['saswp_creativework_date_published_'.$schema_id][0])? saswp_format_date_time($all_post_meta['saswp_creativework_date_published_'.$schema_id][0], get_post_time('h:i:s')):'',
3741
+ 'dateModified' => isset($all_post_meta['saswp_creativework_date_modified_'.$schema_id][0])? saswp_format_date_time($all_post_meta['saswp_creativework_date_modified_'.$schema_id][0], get_the_modified_time('h:i:s')):'',
3742
+
3743
+ );
3744
+
3745
+ $input1['author']['@type'] = 'Person';
3746
+
3747
+ if(isset( $all_post_meta['saswp_creativework_author_type_'.$schema_id][0] )){
3748
+ $input1['author']['@type'] = $all_post_meta['saswp_creativework_author_type_'.$schema_id][0];
3749
+ }
3750
+
3751
+ $input1['author']['name'] = saswp_remove_warnings($all_post_meta, 'saswp_creativework_author_name_'.$schema_id, 'saswp_array');
3752
+ $input1['author']['description'] = saswp_remove_warnings($all_post_meta, 'saswp_creativework_author_description_'.$schema_id, 'saswp_array');
3753
+ $input1['author']['url'] = saswp_remove_warnings($all_post_meta, 'saswp_creativework_author_url_'.$schema_id, 'saswp_array');
3754
+
3755
+ if(isset($all_post_meta['saswp_creativework_organization_logo_'.$schema_id][0]) || isset($all_post_meta['saswp_creativework_organization_name_'.$schema_id][0])){
3756
+
3757
+ $input1['publisher']['@type'] = 'Organization';
3758
+ $input1['publisher']['logo']['@type'] = 'ImageObject';
3759
+ $input1['publisher']['logo']['url'] = saswp_remove_warnings($all_post_meta, 'saswp_creativework_organization_logo_'.$schema_id, 'saswp_array');
3760
+ $input1['publisher']['logo']['width'] = saswp_remove_warnings($slogo, 'width', 'saswp_string');
3761
+ $input1['publisher']['logo']['height'] = saswp_remove_warnings($slogo, 'height', 'saswp_string');
3762
+ $input1['publisher']['name'] = saswp_remove_warnings($all_post_meta, 'saswp_creativework_organization_name_'.$schema_id, 'saswp_array');
3763
+
3764
+ }
3765
+
3766
+ $itemlist = get_post_meta($schema_post_id, 'article_items_'.$schema_id, true);
3767
+
3768
+ if($itemlist){
3769
+
3770
+ $list_arr = array();
3771
+
3772
+ foreach ($itemlist as $list){
3773
+ $list_arr[] = $list['saswp_creativework_items_name'];
3774
+ }
3775
+
3776
+ $input1['mainEntity']['@type'] = 'ItemList';
3777
+ $input1['mainEntity']['itemListElement'] = $list_arr;
3778
+ $input1['mainEntity']['itemListOrder'] = 'http://schema.org/ItemListOrderAscending ';
3779
+ $input1['mainEntity']['name'] = saswp_get_the_title();
3780
+
3781
+ }
3782
+
3783
+ return $input1;
3784
+
3785
+ }
3786
+
3787
  function saswp_tech_article_schema_markup($schema_id, $schema_post_id, $all_post_meta){
3788
 
3789
  $input1 = array();
output/output.php CHANGED
@@ -660,11 +660,13 @@ function saswp_schema_output() {
660
  break;
661
 
662
  case 'Person':
663
-
664
- $input1['@context'] = saswp_context_url();
665
- $input1['@type'] = 'Person';
666
- $input1['@id'] = trailingslashit(saswp_get_permalink()).'#Person';
667
- $input1['name'] = saswp_get_the_title();
 
 
668
  $input1['address']['@type'] = 'PostalAddress';
669
 
670
  $input1 = apply_filters('saswp_modify_person_schema_output', $input1 );
@@ -1283,6 +1285,51 @@ function saswp_schema_output() {
1283
 
1284
  break;
1285
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1286
  case 'Article':
1287
 
1288
  $input1 = $service_object->saswp_schema_markup_generator($schema_type);
660
  break;
661
 
662
  case 'Person':
663
+
664
+ $author_id = get_the_author_meta( 'ID' );
665
+
666
+ $input1['@context'] = saswp_context_url();
667
+ $input1 = array_merge($input1, saswp_get_author_details());
668
+ $input1['url'] = get_the_author_meta('user_url', $author_id);
669
+
670
  $input1['address']['@type'] = 'PostalAddress';
671
 
672
  $input1 = apply_filters('saswp_modify_person_schema_output', $input1 );
1285
 
1286
  break;
1287
 
1288
+ case 'VisualArtwork':
1289
+
1290
+ $input1 = array(
1291
+ '@context' => saswp_context_url(),
1292
+ '@type' => $schema_type ,
1293
+ '@id' => trailingslashit(saswp_get_permalink()).'#VisualArtwork',
1294
+ 'url' => trailingslashit(saswp_get_current_url()),
1295
+ 'description' => saswp_get_the_excerpt(),
1296
+ 'name' => saswp_get_the_title(),
1297
+ 'dateCreated' => esc_html($date),
1298
+ 'creator' => saswp_get_author_details()
1299
+ );
1300
+
1301
+ $input1 = apply_filters('saswp_modify_visualartwork_schema_output', $input1 );
1302
+
1303
+ $input1 = saswp_get_modified_markup($input1, $schema_type, $schema_post_id, $schema_options);
1304
+
1305
+ if($modified_schema == 1){
1306
+
1307
+ $input1 = saswp_visualartwork_schema_markup($schema_post_id, get_the_ID(), $all_post_meta);
1308
+ }
1309
+
1310
+ break;
1311
+
1312
+ case 'CreativeWork':
1313
+
1314
+ $input1 = $service_object->saswp_schema_markup_generator($schema_type);
1315
+
1316
+ $mainentity = saswp_get_mainEntity($schema_post_id);
1317
+
1318
+ if($mainentity){
1319
+ $input1['mainEntity'] = $mainentity;
1320
+ }
1321
+
1322
+ $input1 = apply_filters('saswp_modify_creativework_schema_output', $input1 );
1323
+
1324
+ $input1 = saswp_get_modified_markup($input1, $schema_type, $schema_post_id, $schema_options);
1325
+
1326
+ if($modified_schema == 1){
1327
+
1328
+ $input1 = saswp_creativework_schema_markup($schema_post_id, get_the_ID(), $all_post_meta);
1329
+ }
1330
+
1331
+ break;
1332
+
1333
  case 'Article':
1334
 
1335
  $input1 = $service_object->saswp_schema_markup_generator($schema_type);
output/service.php CHANGED
@@ -1142,6 +1142,121 @@ Class saswp_output_service{
1142
  }
1143
  break;
1144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1145
  case 'Photograph':
1146
 
1147
  if(isset($custom_fields['saswp_photograph_image'])){
@@ -1667,11 +1782,7 @@ Class saswp_output_service{
1667
 
1668
  if(isset($custom_fields['saswp_webpage_section'])){
1669
  $input1['mainEntity']['articleSection'] = $custom_fields['saswp_webpage_section'];
1670
- }
1671
- if(isset($custom_fields['saswp_webpage_body'])){
1672
- $input1['mainEntity']['articleBody'] = $custom_fields['saswp_webpage_body'];
1673
- }
1674
-
1675
  if(isset($custom_fields['saswp_webpage_keywords'])){
1676
  $input1['mainEntity']['keywords'] = $custom_fields['saswp_webpage_keywords'];
1677
  }
@@ -2012,16 +2123,16 @@ Class saswp_output_service{
2012
  if(isset($custom_fields['saswp_recipe_name'])){
2013
  $input1['name'] = $custom_fields['saswp_recipe_name'];
2014
  }
 
 
 
2015
  if(isset($custom_fields['saswp_recipe_date_published'])){
2016
  $input1['datePublished'] = $custom_fields['saswp_recipe_date_published'];
2017
  }
2018
 
2019
  if(isset($custom_fields['saswp_recipe_date_modified'])){
2020
  $input1['dateModified'] = $custom_fields['saswp_recipe_date_modified'];
2021
- }
2022
- if(isset($custom_fields['saswp_recipe_description'])){
2023
- $input1['description'] = wp_strip_all_tags(strip_shortcodes( $custom_fields['saswp_recipe_description'] )) ;
2024
- }
2025
  if(isset($custom_fields['saswp_recipe_main_entity'])){
2026
  $input1['mainEntity']['@id'] = $custom_fields['saswp_recipe_main_entity'];
2027
  }
@@ -3987,11 +4098,7 @@ Class saswp_output_service{
3987
  $product_details['product_mpn'] = get_the_ID();
3988
  }
3989
 
3990
- if(strtolower( $product->get_stock_status() ) == 'onbackorder'){
3991
- $product_details['product_availability'] = 'PreOrder';
3992
- }else{
3993
- $product_details['product_availability'] = $product->get_stock_status();
3994
- }
3995
 
3996
  $woo_price = $product->get_price();
3997
 
@@ -4499,7 +4606,8 @@ Class saswp_output_service{
4499
  case 'TechArticle':
4500
  case 'Photograph':
4501
  case 'Blogposting':
4502
- case 'BlogPosting':
 
4503
 
4504
  $input1 = array(
4505
  '@context' => saswp_context_url(),
@@ -4589,8 +4697,7 @@ Class saswp_output_service{
4589
  '@type' => 'Article',
4590
  'mainEntityOfPage' => saswp_get_permalink(),
4591
  'headline' => saswp_get_the_title(),
4592
- 'description' => saswp_get_the_excerpt(),
4593
- 'articleBody' => saswp_get_the_content(),
4594
  'keywords' => saswp_get_the_tags(),
4595
  'datePublished' => esc_html($date),
4596
  'dateModified' => esc_html($modified_date),
1142
  }
1143
  break;
1144
 
1145
+ case 'CreativeWork':
1146
+
1147
+ if(isset($custom_fields['saswp_creativework_main_entity_of_page'])){
1148
+ $input1['mainEntityOfPage'] = $custom_fields['saswp_creativework_main_entity_of_page'];
1149
+ }
1150
+ if(isset($custom_fields['saswp_creativework_image'])){
1151
+ $input1['image'] = $custom_fields['saswp_creativework_image'];
1152
+ }
1153
+ if(isset($custom_fields['saswp_creativework_url'])){
1154
+ $input1['url'] = saswp_validate_url($custom_fields['saswp_creativework_url']);
1155
+ }
1156
+ if(isset($custom_fields['saswp_creativework_body'])){
1157
+ $input1['articleBody'] = $custom_fields['saswp_creativework_body'];
1158
+ }
1159
+ if(isset($custom_fields['saswp_creativework_keywords'])){
1160
+ $input1['keywords'] = $custom_fields['saswp_creativework_keywords'];
1161
+ }
1162
+ if(isset($custom_fields['saswp_creativework_section'])){
1163
+ $input1['articleSection'] = $custom_fields['saswp_creativework_section'];
1164
+ }
1165
+ if(isset($custom_fields['saswp_creativework_inlanguage'])){
1166
+ $input1['inLanguage'] = $custom_fields['saswp_creativework_inlanguage'];
1167
+ }
1168
+ if(isset($custom_fields['saswp_creativework_headline'])){
1169
+ $input1['headline'] = $custom_fields['saswp_creativework_headline'];
1170
+ }
1171
+ if(isset($custom_fields['saswp_creativework_description'])){
1172
+ $input1['description'] = wp_strip_all_tags(strip_shortcodes( $custom_fields['saswp_creativework_description'] ));
1173
+ }
1174
+ if(isset($custom_fields['saswp_creativework_date_published'])){
1175
+ $input1['datePublished'] = $custom_fields['saswp_creativework_date_published'];
1176
+ }
1177
+ if(isset($custom_fields['saswp_creativework_date_modified'])){
1178
+ $input1['dateModified'] = $custom_fields['saswp_creativework_date_modified'];
1179
+ }
1180
+ if(isset($custom_fields['saswp_creativework_editor_name']) && $custom_fields['saswp_creativework_editor_name'] != '') {
1181
+ $input1['editor'] = array();
1182
+ $input1['editor']['@type'] = 'Person';
1183
+ $input1['editor']['name'] = $custom_fields['saswp_creativework_editor_name'];
1184
+ }
1185
+ if(isset($custom_fields['saswp_creativework_author_type'])){
1186
+ $input1['author']['@type'] = $custom_fields['saswp_creativework_author_type'];
1187
+ }
1188
+ if(isset($custom_fields['saswp_creativework_author_name'])){
1189
+ $input1['author']['name'] = $custom_fields['saswp_creativework_author_name'];
1190
+ }
1191
+ if(isset($custom_fields['saswp_creativework_author_description'])){
1192
+ $input1['author']['description'] = $custom_fields['saswp_creativework_author_description'];
1193
+ }
1194
+ if(isset($custom_fields['saswp_creativework_author_url'])){
1195
+ $input1['author']['url'] = $custom_fields['saswp_creativework_author_url'];
1196
+ }
1197
+ if(isset($custom_fields['saswp_creativework_organization_logo']) && isset($custom_fields['saswp_creativework_organization_name'])){
1198
+ $input1['publisher']['@type'] = 'Organization';
1199
+ $input1['publisher']['name'] = $custom_fields['saswp_creativework_organization_name'];
1200
+ $input1['publisher']['logo'] = $custom_fields['saswp_creativework_organization_logo'];
1201
+ }
1202
+ break;
1203
+
1204
+ case 'VisualArtwork':
1205
+
1206
+ if(isset($custom_fields['saswp_visualartwork_url'])){
1207
+ $input1['url'] = saswp_validate_url($custom_fields['saswp_visualartwork_url']);
1208
+ }
1209
+ if(isset($custom_fields['saswp_visualartwork_name'])){
1210
+ $input1['name'] = $custom_fields['saswp_visualartwork_name'];
1211
+ }
1212
+ if(isset($custom_fields['saswp_visualartwork_alternate_name'])){
1213
+ $input1['alternateName'] = $custom_fields['saswp_visualartwork_alternate_name'];
1214
+ }
1215
+ if(isset($custom_fields['saswp_visualartwork_description'])){
1216
+ $input1['description'] = wp_strip_all_tags(strip_shortcodes( $custom_fields['saswp_visualartwork_description'] ));
1217
+ }
1218
+ if(isset($custom_fields['saswp_visualartwork_date_created'])){
1219
+ $input1['dateCreated'] = $custom_fields['saswp_visualartwork_date_created'];
1220
+ }
1221
+ if(isset($custom_fields['saswp_visualartwork_image'])){
1222
+ $input1['image'] = $custom_fields['saswp_visualartwork_image'];
1223
+ }
1224
+ if(isset($custom_fields['saswp_visualartwork_artform'])){
1225
+ $input1['artform'] = $custom_fields['saswp_visualartwork_artform'];
1226
+ }
1227
+ if(isset($custom_fields['saswp_visualartwork_artedition'])){
1228
+ $input1['artEdition'] = $custom_fields['saswp_visualartwork_artedition'];
1229
+ }
1230
+ if(isset($custom_fields['saswp_visualartwork_artwork_surface'])){
1231
+ $input1['artworkSurface'] = $custom_fields['saswp_visualartwork_artwork_surface'];
1232
+ }
1233
+ if(isset($custom_fields['saswp_visualartwork_artmedium'])){
1234
+ $input1['artMedium'] = explode(',', $custom_fields['saswp_visualartwork_artmedium']);
1235
+ }
1236
+ if(isset($custom_fields['saswp_visualartwork_width'])){
1237
+ $input1['width']['@type'] = 'Distance';
1238
+ $input1['width']['name'] = $custom_fields['saswp_visualartwork_width'];
1239
+ }
1240
+ if(isset($custom_fields['saswp_visualartwork_height'])){
1241
+ $input1['height']['@type'] = 'Distance';
1242
+ $input1['height']['name'] = $custom_fields['saswp_visualartwork_height'];
1243
+ }
1244
+
1245
+ if(isset($custom_fields['saswp_visualartwork_author_type'])){
1246
+ $input1['creator']['@type'] = $custom_fields['saswp_visualartwork_author_type'];
1247
+ }
1248
+ if(isset($custom_fields['saswp_visualartwork_author_name'])){
1249
+ $input1['creator']['name'] = $custom_fields['saswp_visualartwork_author_name'];
1250
+ }
1251
+ if(isset($custom_fields['saswp_visualartwork_author_description'])){
1252
+ $input1['creator']['description'] = $custom_fields['saswp_visualartwork_author_description'];
1253
+ }
1254
+ if(isset($custom_fields['saswp_visualartwork_author_url'])){
1255
+ $input1['creator']['url'] = $custom_fields['saswp_visualartwork_author_url'];
1256
+ }
1257
+
1258
+
1259
+ break;
1260
  case 'Photograph':
1261
 
1262
  if(isset($custom_fields['saswp_photograph_image'])){
1782
 
1783
  if(isset($custom_fields['saswp_webpage_section'])){
1784
  $input1['mainEntity']['articleSection'] = $custom_fields['saswp_webpage_section'];
1785
+ }
 
 
 
 
1786
  if(isset($custom_fields['saswp_webpage_keywords'])){
1787
  $input1['mainEntity']['keywords'] = $custom_fields['saswp_webpage_keywords'];
1788
  }
2123
  if(isset($custom_fields['saswp_recipe_name'])){
2124
  $input1['name'] = $custom_fields['saswp_recipe_name'];
2125
  }
2126
+ if(isset($custom_fields['saswp_recipe_description'])){
2127
+ $input1['description'] = wp_strip_all_tags(strip_shortcodes( $custom_fields['saswp_recipe_description'] )) ;
2128
+ }
2129
  if(isset($custom_fields['saswp_recipe_date_published'])){
2130
  $input1['datePublished'] = $custom_fields['saswp_recipe_date_published'];
2131
  }
2132
 
2133
  if(isset($custom_fields['saswp_recipe_date_modified'])){
2134
  $input1['dateModified'] = $custom_fields['saswp_recipe_date_modified'];
2135
+ }
 
 
 
2136
  if(isset($custom_fields['saswp_recipe_main_entity'])){
2137
  $input1['mainEntity']['@id'] = $custom_fields['saswp_recipe_main_entity'];
2138
  }
4098
  $product_details['product_mpn'] = get_the_ID();
4099
  }
4100
 
4101
+ $product_details['product_availability'] = saswp_prepend_schema_org($product->get_stock_status());
 
 
 
 
4102
 
4103
  $woo_price = $product->get_price();
4104
 
4606
  case 'TechArticle':
4607
  case 'Photograph':
4608
  case 'Blogposting':
4609
+ case 'BlogPosting':
4610
+ case 'CreativeWork':
4611
 
4612
  $input1 = array(
4613
  '@context' => saswp_context_url(),
4697
  '@type' => 'Article',
4698
  'mainEntityOfPage' => saswp_get_permalink(),
4699
  'headline' => saswp_get_the_title(),
4700
+ 'description' => saswp_get_the_excerpt(),
 
4701
  'keywords' => saswp_get_the_tags(),
4702
  'datePublished' => esc_html($date),
4703
  'dateModified' => esc_html($modified_date),
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: magazine3
3
  Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
4
  Requires at least: 3.0
5
  Tested up to: 5.7
6
- Stable tag: 1.9.79
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -120,6 +120,20 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)
120
 
121
  == Changelog ==
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  = 1.9.79 (15 Jun 2021) =
124
 
125
  * Fixed: Bark reviews do not redirect to their origin reviews url #1445
3
  Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
4
  Requires at least: 3.0
5
  Tested up to: 5.7
6
+ Stable tag: 1.9.80
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
120
 
121
  == Changelog ==
122
 
123
+ = 1.9.80 (23 Jun 2021) =
124
+
125
+ * Fixed: Item name mismatches when We try to activate "1-Click Indexing API Integration" extension. #1454
126
+ * Fixed: Validation error in GSC: Unparable structured data (incorrect value type) #1452
127
+ * Fixed: Availability should have full string like what mentioned in google example. Such as "https://schema.org/InStock" #1453
128
+ * Fixed: Recipe schema's properties should be in proper order #1450
129
+ * Added: Schedule property to Event schema #1044
130
+ * Added: Author placement option #1281
131
+ * Added: Book Guteberg block #930
132
+ * Added: Creative Work schema #1204
133
+ * Added: Visual Artwork schema #1377
134
+ * Added: Integration with multi-currency plugin for woocommerce. #1160
135
+
136
+
137
  = 1.9.79 (15 Jun 2021) =
138
 
139
  * Fixed: Bark reviews do not redirect to their origin reviews url #1445
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.79
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.79');
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.80
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.80');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));