WP SEO Structured Data Schema - Version 2.5.4

Version Description

  • Add a Hack

=

Download this release

Release Info

Developer kcseopro
Plugin Icon 128x128 WP SEO Structured Data Schema
Version 2.5.4
Comparing to
See all releases

Code changes from version 2.5.3 to 2.5.4

README.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
  Tags: seo, schema, structured data, rich snippets, microdata, json-ld, search engine optimization, local seo, google, sitelinks, schema.org, microformat, serp
5
  Requires at least: 4.5
6
  Tested up to: 5.0
7
- Stable tag: 2.5.3
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -120,6 +120,9 @@ You'll find the [FAQ on Kcseopro.com](https://wpsemplugins.com/).
120
 
121
  == Changelog ==
122
 
 
 
 
123
  == 2.5.3 =
124
  * Bug fixed
125
 
4
  Tags: seo, schema, structured data, rich snippets, microdata, json-ld, search engine optimization, local seo, google, sitelinks, schema.org, microformat, serp
5
  Requires at least: 4.5
6
  Tested up to: 5.0
7
+ Stable tag: 2.5.4
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
120
 
121
  == Changelog ==
122
 
123
+ == 2.5.4 =
124
+ * Add a Hack
125
+
126
  == 2.5.3 =
127
  * Bug fixed
128
 
lib/classes/KcSeoOutput.php CHANGED
@@ -1,192 +1,194 @@
1
  <?php
2
 
3
- if ( ! class_exists( 'KcSeoOutput' ) ):
4
-
5
- class KcSeoOutput {
6
- function __construct() {
7
- add_action( 'wp_footer', array( $this, 'footer' ), 1 );
8
- add_action( 'kcseo_footer', array( $this, 'debug_mark' ), 2 );
9
- add_action( 'kcseo_footer', array( $this, 'load_schema' ), 3 );
10
- }
11
- private function is_premium(){
12
- return false;
13
- }
14
- private function head_product_name() {
15
- if ( $this->is_premium() ) {
16
- return 'WP SEO Structured Data pro plugin';
17
- }
18
- else {
19
- return 'WP SEO Structured Data Plugin';
20
- }
21
- }
22
- public function debug_mark( $echo = true ) {
23
- $marker = sprintf(
24
- '<!-- This site is optimized with Phil Singleton\'s ' . $this->head_product_name() . ' v%1$s - https://kcseopro.com/wordpress-seo-structured-data-schema-plugin/ -->',
25
- KCSEO_WP_SCHEMA_VERSION
26
- );
27
-
28
- if ( $echo === false ) {
29
- return $marker;
30
- }
31
- else {
32
- echo "\n${marker}\n";
33
- }
34
- }
35
-
36
- function footer(){
37
-
38
- global $wp_query;
39
-
40
- $old_wp_query = null;
41
-
42
- if ( ! $wp_query->is_main_query() ) {
43
- $old_wp_query = $wp_query;
44
- wp_reset_query();
45
- }
46
- wp_reset_postdata(); // TODO This is for wrong theme loop
47
- do_action( 'kcseo_footer' );
48
-
49
- echo "\n<!-- / ", $this->head_product_name(), ". -->\n\n";
50
-
51
- if ( ! empty( $old_wp_query ) ) {
52
- $GLOBALS['wp_query'] = $old_wp_query;
53
- unset( $old_wp_query );
54
- }
55
-
56
- return;
57
- }
58
-
59
- function load_schema() {
60
- global $KcSeoWPSchema, $post;
61
- $schemaModel = new KcSeoSchemaModel;
62
- $html = null;
63
- $settings = get_option( $KcSeoWPSchema->options['settings'] );
64
- if ( is_home() || is_front_page() ) {
65
- $metaData = array();
66
-
67
- $metaData["@context"] = "http://schema.org/";
68
- $metaData["@type"] = "WebSite";
69
-
70
- if ( ! empty( $settings['homeonly'] ) && $settings['homeonly']) {
71
- $author_url = ( ! empty( $settings['siteurl'] ) ? $settings['siteurl'] : get_home_url() );
72
- $to_remove = array( 'http://', 'https://', 'www.' );
73
- foreach ( $to_remove as $item ) {
74
- $author_url = str_replace( $item, '', $author_url ); // to: www.example.com
75
- }
76
- $metaData["url"] = $KcSeoWPSchema->sanitizeOutPut( $author_url, 'url' );
77
- $metaData["name"] = ! empty( $settings['sitename'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['sitename'] ) : null;
78
- $metaData["alternateName"] = ! empty( $settings['siteaname'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['siteaname'] ) : null;
79
- $html .= $schemaModel->get_jsonEncode( $metaData );
80
- } else {
81
- $metaData["url"] = get_home_url();
82
- $metaData["potentialAction"] = array(
83
- "@type" => "SearchAction",
84
- "target" => get_home_url() . "/?s={query}",
85
- "query-input" => "required name=query"
86
- );
87
- $html .= $schemaModel->get_jsonEncode( $metaData );
88
- }
89
- }
90
- $webMeta = array();
91
- $webMeta["@context"] = "http://schema.org";
92
- $siteType = ! empty( $settings['site_type'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['site_type'] ) : null;
93
- $webMeta["@type"] = $siteType;
94
- if($siteType != "Organization"){
95
- if(! empty( $settings['site_image'] ) && $imgID = absint($settings['site_image'])){
96
- $image_url = wp_get_attachment_url( $imgID, 'full' );
97
- $webMeta["image"] = $KcSeoWPSchema->sanitizeOutPut( $image_url, 'url' );
98
- }else{
99
- $webMeta["image"] = null;
100
- }
101
- $webMeta["priceRange"] = ! empty( $settings['site_price_range'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['site_price_range'] ) : null;
102
- $webMeta["telephone"] = ! empty( $settings['site_telephone'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['site_telephone'] ) : null;
103
- }
104
-
105
- if ( ! empty( $settings['additionalType'] ) ) {
106
- $aType = explode( "\r\n", $settings['additionalType'] );
107
- if ( ! empty( $aType ) && is_array( $aType ) ) {
108
- if ( count( $aType ) == 1 ) {
109
- $webMeta["additionalType"] = $aType[0];
110
- } else if ( count( $aType ) > 1 ) {
111
- $webMeta["additionalType"] = $aType;
112
- }
113
- }
114
- }
115
-
116
- if ( $siteType == 'Person' ) {
117
- $webMeta["name"] = ! empty( $settings['person']['name'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['person']['name'] ) : null;
118
- $webMeta["worksFor"] = ! empty( $settings['person']['worksFor'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['person']['worksFor'] ) : null;
119
- $webMeta["jobTitle"] = ! empty( $settings['person']['jobTitle'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['person']['jobTitle'] ) : null;
120
- $webMeta["image"] = ! empty( $settings['person']['image'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['person']['image'], 'url' ) : null;
121
- $webMeta["description"] = ! empty( $settings['person']['description'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['person']['description'], 'textarea' ) : null;
122
- $webMeta["birthDate"] = ! empty( $settings['person']['birthDate'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['person']['birthDate'] ) : null;
123
- } else {
124
- $webMeta["name"] = ! empty( $settings['type_name'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['type_name'] ) : null;
125
- if(! empty( $settings['organization_logo'] ) && $imgID = absint($settings['organization_logo'])){
126
- $image_url = wp_get_attachment_url( $imgID, 'full' );
127
- $webMeta["logo"] = $KcSeoWPSchema->sanitizeOutPut( $image_url, 'url' );
128
- }else{
129
- $webMeta["logo"] = null;
130
- }
131
- }
132
- if ( $siteType != "Organization" && $siteType != "Person" ) {
133
- $webMeta["description"] = ! empty( $settings['business_info']['description'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['business_info']['description'], 'textarea' ) : null;
134
- if ( ! empty( $settings['business_info']['openingHours'] ) ) {
135
- $aOhour = explode( "\r\n", $settings['business_info']['openingHours'] );
136
- if ( ! empty( $aOhour ) && is_array( $aOhour ) ) {
137
- if ( count( $aOhour ) == 1 ) {
138
- $webMeta["openingHours"] = $aOhour[0];
139
- } else if ( count( $aOhour ) > 1 ) {
140
- $webMeta["openingHours"] = $aOhour;
141
- }
142
- }
143
- }
144
- $webMeta["geo"] = array(
145
- "@type" => "GeoCoordinates",
146
- "latitude" => ! empty( $settings['business_info']['latitude'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['business_info']['latitude'] ) : null,
147
- "longitude" => ! empty( $settings['business_info']['longitude'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['business_info']['longitude'] ) : null,
148
- );
149
- }
150
-
151
- if(in_array($siteType, array('FoodEstablishment', 'Bakery','BarOrPub','Brewery','CafeOrCoffeeShop','FastFoodRestaurant','IceCreamShop','Restaurant','Winery'))){
152
- $webMeta["servesCuisine"] = !empty($settings['restaurant']['servesCuisine']) ? $KcSeoWPSchema->sanitizeOutPut( $settings['restaurant']['servesCuisine'], 'textarea' ) : null;
153
- }
154
-
155
- $webMeta["url"] = ! empty( $settings['web_url'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['web_url'], 'url' ) : $KcSeoWPSchema->sanitizeOutPut( get_home_url(), 'url');
156
- if ( ! empty( $settings['social'] ) && is_array( $settings['social'] ) ) {
157
- $link = array();
158
- foreach ( $settings['social'] as $socialD ) {
159
- if ( $socialD['link'] ) {
160
- $link[] = $socialD['link'];
161
- }
162
- }
163
- if ( ! empty( $link ) ) {
164
- $webMeta["sameAs"] = $link;
165
- }
166
- }
167
-
168
- $webMeta["contactPoint"] = array(
169
- "@type" => "ContactPoint",
170
- "telephone" => ! empty( $settings['contact']['telephone'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['contact']['telephone'] ) : (! empty( $settings['site_telephone'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['site_telephone'] ) : null),
171
- "contactType" => ! empty( $settings['contact']['contactType'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['contact']['contactType'] ) : '',
172
- "email" => ! empty( $settings['contact']['email'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['contact']['email'] ) : '',
173
- "contactOption" => ! empty( $settings['contact']['contactOption'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['contact']['contactOption'] ) : '',
174
- "areaServed" => ! empty( $settings['area_served'] ) ? implode( ',',
175
- ! empty( $settings['area_served'] ) ? $settings['area_served'] : array() ) : '',
176
- "availableLanguage" => ! empty( $settings['availableLanguage'] ) ? @implode( ',',
177
- ! empty( $settings['availableLanguage'] ) ? $settings['availableLanguage'] : array() ) : null
178
- );
179
- $webMeta["address"] = array(
180
- "@type" => "PostalAddress",
181
- "addressCountry" => ! empty( $settings['address']['country'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['address']['country'] ) : null,
182
- "addressLocality" => ! empty( $settings['address']['locality'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['address']['locality'] ) : null,
183
- "addressRegion" => ! empty( $settings['address']['region'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['address']['region'] ) : null,
184
- "postalCode" => ! empty( $settings['address']['postalcode'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['address']['postalcode'] ) : null,
185
- "streetAddress" => ! empty( $settings['address']['street'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['address']['street'] ) : null
186
- );
187
-
188
- $main_settings = get_option( $KcSeoWPSchema->options['main_settings'] );
189
- $site_schema = !empty($main_settings['site_schema']) ? $main_settings['site_schema'] : 'home_page';
 
 
190
  if ($site_schema !== 'off') {
191
  if ($webMeta["@type"]) {
192
  if ($site_schema == 'home_page') {
@@ -199,17 +201,18 @@ if ( ! class_exists( 'KcSeoOutput' ) ):
199
  }
200
  }
201
 
202
- if ( is_single() || is_page() ) {
203
- foreach ( $schemaModel->schemaTypes() as $schemaID => $schema ) {
204
- $schemaMetaId = $KcSeoWPSchema->KcSeoPrefix . $schemaID;
205
- $metaData = get_post_meta($post->ID, $schemaMetaId, true );
206
- $metaData = (is_array($metaData) ? $metaData : array());
207
- if ( ! empty( $metaData ) && !empty( $metaData['active'] ) ) {
208
- $html .= $schemaModel->schemaOutput( $schemaID, $metaData );
209
- }
210
- }
211
- }
212
- echo $html;
213
- }
214
- }
 
215
  endif;
1
  <?php
2
 
3
+ if (!class_exists('KcSeoOutput')):
4
+
5
+ class KcSeoOutput
6
+ {
7
+ function __construct() {
8
+ add_action('wp_footer', array($this, 'footer'), 1);
9
+ add_action('kcseo_footer', array($this, 'debug_mark'), 2);
10
+ add_action('kcseo_footer', array($this, 'load_schema'), 3);
11
+ }
12
+
13
+ private function is_premium() {
14
+ return false;
15
+ }
16
+
17
+ private function head_product_name() {
18
+ if ($this->is_premium()) {
19
+ return 'WP SEO Structured Data pro plugin';
20
+ } else {
21
+ return 'WP SEO Structured Data Plugin';
22
+ }
23
+ }
24
+
25
+ public function debug_mark($echo = true) {
26
+ $marker = sprintf(
27
+ '<!-- This site is optimized with Phil Singleton\'s ' . $this->head_product_name() . ' v%1$s - https://kcseopro.com/wordpress-seo-structured-data-schema-plugin/ -->',
28
+ KCSEO_WP_SCHEMA_VERSION
29
+ );
30
+
31
+ if ($echo === false) {
32
+ return $marker;
33
+ } else {
34
+ echo "\n${marker}\n";
35
+ }
36
+ }
37
+
38
+ function footer() {
39
+
40
+ global $wp_query;
41
+
42
+ $old_wp_query = null;
43
+
44
+ if (!$wp_query->is_main_query()) {
45
+ $old_wp_query = $wp_query;
46
+ wp_reset_query();
47
+ }
48
+ wp_reset_postdata(); // TODO This is for wrong theme loop
49
+ do_action('kcseo_footer');
50
+
51
+ echo "\n<!-- / ", $this->head_product_name(), ". -->\n\n";
52
+
53
+ if (!empty($old_wp_query)) {
54
+ $GLOBALS['wp_query'] = $old_wp_query;
55
+ unset($old_wp_query);
56
+ }
57
+
58
+ return;
59
+ }
60
+
61
+ function load_schema() {
62
+ global $KcSeoWPSchema;
63
+ $schemaModel = new KcSeoSchemaModel;
64
+ $html = null;
65
+ $settings = get_option($KcSeoWPSchema->options['settings']);
66
+ if (is_home() || is_front_page()) {
67
+ $metaData = array();
68
+
69
+ $metaData["@context"] = "http://schema.org/";
70
+ $metaData["@type"] = "WebSite";
71
+
72
+ if (!empty($settings['homeonly']) && $settings['homeonly']) {
73
+ $author_url = (!empty($settings['siteurl']) ? $settings['siteurl'] : get_home_url());
74
+ $to_remove = array('http://', 'https://', 'www.');
75
+ foreach ($to_remove as $item) {
76
+ $author_url = str_replace($item, '', $author_url); // to: www.example.com
77
+ }
78
+ $metaData["url"] = $KcSeoWPSchema->sanitizeOutPut($author_url, 'url');
79
+ $metaData["name"] = !empty($settings['sitename']) ? $KcSeoWPSchema->sanitizeOutPut($settings['sitename']) : null;
80
+ $metaData["alternateName"] = !empty($settings['siteaname']) ? $KcSeoWPSchema->sanitizeOutPut($settings['siteaname']) : null;
81
+ $html .= $schemaModel->get_jsonEncode($metaData);
82
+ } else {
83
+ $metaData["url"] = get_home_url();
84
+ $metaData["potentialAction"] = array(
85
+ "@type" => "SearchAction",
86
+ "target" => get_home_url() . "/?s={query}",
87
+ "query-input" => "required name=query"
88
+ );
89
+ $html .= $schemaModel->get_jsonEncode($metaData);
90
+ }
91
+ }
92
+ $webMeta = array();
93
+ $webMeta["@context"] = "http://schema.org";
94
+ $siteType = !empty($settings['site_type']) ? $KcSeoWPSchema->sanitizeOutPut($settings['site_type']) : null;
95
+ $webMeta["@type"] = $siteType;
96
+ if ($siteType != "Organization") {
97
+ if (!empty($settings['site_image']) && $imgID = absint($settings['site_image'])) {
98
+ $image_url = wp_get_attachment_url($imgID, 'full');
99
+ $webMeta["image"] = $KcSeoWPSchema->sanitizeOutPut($image_url, 'url');
100
+ } else {
101
+ $webMeta["image"] = null;
102
+ }
103
+ $webMeta["priceRange"] = !empty($settings['site_price_range']) ? $KcSeoWPSchema->sanitizeOutPut($settings['site_price_range']) : null;
104
+ $webMeta["telephone"] = !empty($settings['site_telephone']) ? $KcSeoWPSchema->sanitizeOutPut($settings['site_telephone']) : null;
105
+ }
106
+
107
+ if (!empty($settings['additionalType'])) {
108
+ $aType = explode("\r\n", $settings['additionalType']);
109
+ if (!empty($aType) && is_array($aType)) {
110
+ if (count($aType) == 1) {
111
+ $webMeta["additionalType"] = $aType[0];
112
+ } else if (count($aType) > 1) {
113
+ $webMeta["additionalType"] = $aType;
114
+ }
115
+ }
116
+ }
117
+
118
+ if ($siteType == 'Person') {
119
+ $webMeta["name"] = !empty($settings['person']['name']) ? $KcSeoWPSchema->sanitizeOutPut($settings['person']['name']) : null;
120
+ $webMeta["worksFor"] = !empty($settings['person']['worksFor']) ? $KcSeoWPSchema->sanitizeOutPut($settings['person']['worksFor']) : null;
121
+ $webMeta["jobTitle"] = !empty($settings['person']['jobTitle']) ? $KcSeoWPSchema->sanitizeOutPut($settings['person']['jobTitle']) : null;
122
+ $webMeta["image"] = !empty($settings['person']['image']) ? $KcSeoWPSchema->sanitizeOutPut($settings['person']['image'], 'url') : null;
123
+ $webMeta["description"] = !empty($settings['person']['description']) ? $KcSeoWPSchema->sanitizeOutPut($settings['person']['description'], 'textarea') : null;
124
+ $webMeta["birthDate"] = !empty($settings['person']['birthDate']) ? $KcSeoWPSchema->sanitizeOutPut($settings['person']['birthDate']) : null;
125
+ } else {
126
+ $webMeta["name"] = !empty($settings['type_name']) ? $KcSeoWPSchema->sanitizeOutPut($settings['type_name']) : null;
127
+ if (!empty($settings['organization_logo']) && $imgID = absint($settings['organization_logo'])) {
128
+ $image_url = wp_get_attachment_url($imgID, 'full');
129
+ $webMeta["logo"] = $KcSeoWPSchema->sanitizeOutPut($image_url, 'url');
130
+ } else {
131
+ $webMeta["logo"] = null;
132
+ }
133
+ }
134
+ if ($siteType != "Organization" && $siteType != "Person") {
135
+ $webMeta["description"] = !empty($settings['business_info']['description']) ? $KcSeoWPSchema->sanitizeOutPut($settings['business_info']['description'], 'textarea') : null;
136
+ if (!empty($settings['business_info']['openingHours'])) {
137
+ $aOhour = explode("\r\n", $settings['business_info']['openingHours']);
138
+ if (!empty($aOhour) && is_array($aOhour)) {
139
+ if (count($aOhour) == 1) {
140
+ $webMeta["openingHours"] = $aOhour[0];
141
+ } else if (count($aOhour) > 1) {
142
+ $webMeta["openingHours"] = $aOhour;
143
+ }
144
+ }
145
+ }
146
+ $webMeta["geo"] = array(
147
+ "@type" => "GeoCoordinates",
148
+ "latitude" => !empty($settings['business_info']['latitude']) ? $KcSeoWPSchema->sanitizeOutPut($settings['business_info']['latitude']) : null,
149
+ "longitude" => !empty($settings['business_info']['longitude']) ? $KcSeoWPSchema->sanitizeOutPut($settings['business_info']['longitude']) : null,
150
+ );
151
+ }
152
+
153
+ if (in_array($siteType, array('FoodEstablishment', 'Bakery', 'BarOrPub', 'Brewery', 'CafeOrCoffeeShop', 'FastFoodRestaurant', 'IceCreamShop', 'Restaurant', 'Winery'))) {
154
+ $webMeta["servesCuisine"] = !empty($settings['restaurant']['servesCuisine']) ? $KcSeoWPSchema->sanitizeOutPut($settings['restaurant']['servesCuisine'], 'textarea') : null;
155
+ }
156
+
157
+ $webMeta["url"] = !empty($settings['web_url']) ? $KcSeoWPSchema->sanitizeOutPut($settings['web_url'], 'url') : $KcSeoWPSchema->sanitizeOutPut(get_home_url(), 'url');
158
+ if (!empty($settings['social']) && is_array($settings['social'])) {
159
+ $link = array();
160
+ foreach ($settings['social'] as $socialD) {
161
+ if ($socialD['link']) {
162
+ $link[] = $socialD['link'];
163
+ }
164
+ }
165
+ if (!empty($link)) {
166
+ $webMeta["sameAs"] = $link;
167
+ }
168
+ }
169
+
170
+ $webMeta["contactPoint"] = array(
171
+ "@type" => "ContactPoint",
172
+ "telephone" => !empty($settings['contact']['telephone']) ? $KcSeoWPSchema->sanitizeOutPut($settings['contact']['telephone']) : (!empty($settings['site_telephone']) ? $KcSeoWPSchema->sanitizeOutPut($settings['site_telephone']) : null),
173
+ "contactType" => !empty($settings['contact']['contactType']) ? $KcSeoWPSchema->sanitizeOutPut($settings['contact']['contactType']) : '',
174
+ "email" => !empty($settings['contact']['email']) ? $KcSeoWPSchema->sanitizeOutPut($settings['contact']['email']) : '',
175
+ "contactOption" => !empty($settings['contact']['contactOption']) ? $KcSeoWPSchema->sanitizeOutPut($settings['contact']['contactOption']) : '',
176
+ "areaServed" => !empty($settings['area_served']) ? implode(',',
177
+ !empty($settings['area_served']) ? $settings['area_served'] : array()) : '',
178
+ "availableLanguage" => !empty($settings['availableLanguage']) ? @implode(',',
179
+ !empty($settings['availableLanguage']) ? $settings['availableLanguage'] : array()) : null
180
+ );
181
+ $webMeta["address"] = array(
182
+ "@type" => "PostalAddress",
183
+ "addressCountry" => !empty($settings['address']['country']) ? $KcSeoWPSchema->sanitizeOutPut($settings['address']['country']) : null,
184
+ "addressLocality" => !empty($settings['address']['locality']) ? $KcSeoWPSchema->sanitizeOutPut($settings['address']['locality']) : null,
185
+ "addressRegion" => !empty($settings['address']['region']) ? $KcSeoWPSchema->sanitizeOutPut($settings['address']['region']) : null,
186
+ "postalCode" => !empty($settings['address']['postalcode']) ? $KcSeoWPSchema->sanitizeOutPut($settings['address']['postalcode']) : null,
187
+ "streetAddress" => !empty($settings['address']['street']) ? $KcSeoWPSchema->sanitizeOutPut($settings['address']['street']) : null
188
+ );
189
+
190
+ $main_settings = get_option($KcSeoWPSchema->options['main_settings']);
191
+ $site_schema = !empty($main_settings['site_schema']) ? $main_settings['site_schema'] : 'home_page';
192
  if ($site_schema !== 'off') {
193
  if ($webMeta["@type"]) {
194
  if ($site_schema == 'home_page') {
201
  }
202
  }
203
 
204
+ if (is_single() || is_page()) {
205
+ $post = get_queried_object();
206
+ foreach ($schemaModel->schemaTypes() as $schemaID => $schema) {
207
+ $schemaMetaId = $KcSeoWPSchema->KcSeoPrefix . $schemaID;
208
+ $metaData = get_post_meta($post->ID, $schemaMetaId, true);
209
+ $metaData = (is_array($metaData) ? $metaData : array());
210
+ if (!empty($metaData) && !empty($metaData['active'])) {
211
+ $html .= $schemaModel->schemaOutput($schemaID, $metaData);
212
+ }
213
+ }
214
+ }
215
+ echo $html;
216
+ }
217
+ }
218
  endif;
wp-seo-structured-data-schema.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WP SEO Structured Data Schema
4
  * Plugin URI: https://wpsemplugins.com/
5
  * Description: Comprehensive JSON-LD based Structured Data solution for WordPress for adding schema for organizations, businesses, blog posts, ratings & more.
6
- * Version: 2.5.3
7
  * Author: WPSEMPlugins
8
  * Author URI: https://wpsemplugins.com/
9
  * Text Domain: wp-seo-structured-data-schema
3
  * Plugin Name: WP SEO Structured Data Schema
4
  * Plugin URI: https://wpsemplugins.com/
5
  * Description: Comprehensive JSON-LD based Structured Data solution for WordPress for adding schema for organizations, businesses, blog posts, ratings & more.
6
+ * Version: 2.5.4
7
  * Author: WPSEMPlugins
8
  * Author URI: https://wpsemplugins.com/
9
  * Text Domain: wp-seo-structured-data-schema