Schema & Structured Data for WP & AMP - Version 1.0.8.1

Version Description

(31 January 2019) =

  • Bug Fixed: JSON-LD Error, when yoast compatibility is enabled #133
Download this release

Release Info

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

Code changes from version 1.0.8 to 1.0.8.1

admin_section/structure_admin.php CHANGED
@@ -262,8 +262,14 @@ function saswp_comparison_logic_checker($input){
262
 
263
  // Post Controls ------------
264
  // Posts
265
- case 'post':
266
- $current_post = $post->ID;
 
 
 
 
 
 
267
  if ( $comparison == 'equal' ) {
268
  if ( $current_post == $data ) {
269
  $result = true;
262
 
263
  // Post Controls ------------
264
  // Posts
265
+ case 'post':
266
+
267
+ $current_post ='';
268
+
269
+ if(is_singular()){
270
+ $current_post = $post->ID;
271
+ }
272
+
273
  if ( $comparison == 'equal' ) {
274
  if ( $current_post == $data ) {
275
  $result = true;
output/function.php CHANGED
@@ -17,6 +17,8 @@ function saswp_data_generator() {
17
 
18
  $output = '';
19
  $post_specific_enable = '';
 
 
20
  $contact_page_output = saswp_contact_page_output();
21
  $about_page_output = saswp_about_page_output();
22
 
@@ -108,7 +110,8 @@ function saswp_data_generator() {
108
  }
109
 
110
  }
111
- $stroutput = '['. $output. ']';
 
112
  $filter_string = str_replace(',]', ']',$stroutput);
113
 
114
  echo '<!-- Schema & Structured Data For WP v'.esc_attr(SASWP_VERSION).' - -->';
17
 
18
  $output = '';
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
 
110
  }
111
 
112
  }
113
+
114
+ $stroutput = '['. trim($output). ']';
115
  $filter_string = str_replace(',]', ']',$stroutput);
116
 
117
  echo '<!-- Schema & Structured Data For WP v'.esc_attr(SASWP_VERSION).' - -->';
output/output.php CHANGED
@@ -1226,7 +1226,8 @@ function saswp_post_specific_schema_output() {
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
- foreach($all_schemas as $schema){
 
1230
 
1231
  $schema_id = $schema;
1232
  $schema_type = esc_sql ( get_post_meta($schema_id, 'schema_type', true) );
@@ -2121,7 +2122,9 @@ function saswp_post_specific_schema_output() {
2121
  $all_schema_output[] = $input1;
2122
  }
2123
  }
2124
- }
 
 
2125
  return $all_schema_output;
2126
  }
2127
 
@@ -2228,12 +2231,15 @@ function saswp_schema_breadcrumb_output($sd_data){
2228
  }
2229
 
2230
  function saswp_kb_website_output(){
2231
-
2232
- global $sd_data;
 
2233
  $site_url = get_site_url();
2234
  $site_name = get_bloginfo();
2235
 
2236
- $input = array(
 
 
2237
  '@context' =>'http://schema.org',
2238
  '@type' => 'WebSite',
2239
  'id' => '#website',
@@ -2244,7 +2250,8 @@ function saswp_kb_website_output(){
2244
  'target' => $site_url.'/?s={search_term_string}',
2245
  'query-input' => 'required name=search_term_string',
2246
  )
2247
- );
 
2248
 
2249
  return json_encode($input);
2250
  }
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){
1230
+ foreach($all_schemas as $schema){
1231
 
1232
  $schema_id = $schema;
1233
  $schema_type = esc_sql ( get_post_meta($schema_id, 'schema_type', true) );
2122
  $all_schema_output[] = $input1;
2123
  }
2124
  }
2125
+ }
2126
+ }
2127
+
2128
  return $all_schema_output;
2129
  }
2130
 
2231
  }
2232
 
2233
  function saswp_kb_website_output(){
2234
+
2235
+ $input = array();
2236
+
2237
  $site_url = get_site_url();
2238
  $site_name = get_bloginfo();
2239
 
2240
+ if($site_url && $site_name){
2241
+
2242
+ $input = array(
2243
  '@context' =>'http://schema.org',
2244
  '@type' => 'WebSite',
2245
  'id' => '#website',
2250
  'target' => $site_url.'/?s={search_term_string}',
2251
  'query-input' => 'required name=search_term_string',
2252
  )
2253
+ );
2254
+ }
2255
 
2256
  return json_encode($input);
2257
  }
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
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -65,6 +65,11 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)
65
 
66
  == Changelog ==
67
 
 
 
 
 
 
68
  = 1.0.8 (28 January 2019) =
69
 
70
  * Added: Yoast plugin compatibility ( If yoast is activated for schema. Organization & website markup should not be duplicate )
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
 
66
  == Changelog ==
67
 
68
+ = 1.0.8.1 (31 January 2019) =
69
+
70
+ * Bug Fixed: JSON-LD Error, when yoast compatibility is enabled #133
71
+
72
+
73
  = 1.0.8 (28 January 2019) =
74
 
75
  * Added: Yoast plugin compatibility ( If yoast is activated for schema. Organization & website markup should not be duplicate )
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
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');
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.8.1
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.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__));
view/post_specific.php CHANGED
@@ -715,13 +715,14 @@ class saswp_post_specific {
715
  break;
716
  case 'homeandconstructionbusiness':
717
  $sub_business_options = array(
718
- 'electrician' => 'Electrician',
719
  'generalcontractor' => 'General Contractor',
720
  'hvacbusiness' => 'HVAC Business',
721
  'locksmith' => 'Locksmith',
722
  'movingcompany' => 'Moving Company',
723
  'plumber' => 'Plumber',
724
- 'roofingcontractor' => 'Roofing Contractor',
 
725
  );
726
  break;
727
  case 'legalservice':
715
  break;
716
  case 'homeandconstructionbusiness':
717
  $sub_business_options = array(
718
+ 'electrician' => 'Electrician',
719
  'generalcontractor' => 'General Contractor',
720
  'hvacbusiness' => 'HVAC Business',
721
  'locksmith' => 'Locksmith',
722
  'movingcompany' => 'Moving Company',
723
  'plumber' => 'Plumber',
724
+ 'roofingcontractor' => 'Roofing Contractor',
725
+ 'housepainter' => 'House Painter',
726
  );
727
  break;
728
  case 'legalservice':
view/schema_type.php CHANGED
@@ -742,7 +742,8 @@ function item_reviewed_fields($item, $post_specific = null, $schema_id = null){
742
  'locksmith' => 'Locksmith',
743
  'movingcompany' => 'Moving Company',
744
  'plumber' => 'Plumber',
745
- 'roofingcontractor' => 'Roofing Contractor',
 
746
  );
747
 
748
  $all_legal_service_array = array(
742
  'locksmith' => 'Locksmith',
743
  'movingcompany' => 'Moving Company',
744
  'plumber' => 'Plumber',
745
+ 'roofingcontractor' => 'Roofing Contractor',
746
+ 'housepainter' => 'House Painter',
747
  );
748
 
749
  $all_legal_service_array = array(