Markup (JSON-LD) structured in schema.org - Version 3.2.4

Version Description

(2017-03-30) = * Fixed : BreadcrumbList - Ignore the Home setting when setting the head fixed page. * Fixed : BreadcrumbList - Categories of two or more levels are not displayed. * Fixed : Minor bug fixed. * Updated : Article,BlogPosting and NewsArticle - Limit headline to 110 chars.

Download this release

Release Info

Developer miiitaka
Plugin Icon 128x128 Markup (JSON-LD) structured in schema.org
Version 3.2.4
Comparing to
See all releases

Code changes from version 3.2.3 to 3.2.4

css/style.css CHANGED
@@ -28,6 +28,10 @@
28
  }
29
 
30
  .schema-admin-table-list tr.active {
 
 
 
 
31
  background: #efefef;
32
  }
33
 
28
  }
29
 
30
  .schema-admin-table-list tr.active {
31
+ background: #ffffff;
32
+ }
33
+
34
+ .schema-admin-table-list tr.stop {
35
  background: #efefef;
36
  }
37
 
includes/wp-structuring-admin-list.php CHANGED
@@ -3,7 +3,7 @@
3
  * Schema.org Admin List
4
  *
5
  * @author Kazuya Takami
6
- * @version 3.1.3
7
  * @since 1.0.0
8
  * @see wp-structuring-admin-db.php
9
  */
@@ -32,7 +32,7 @@ class Structuring_Markup_Admin_List {
32
  /**
33
  * LIST Page HTML Render.
34
  *
35
- * @version 3.1.3
36
  * @since 1.0.0
37
  */
38
  private function page_render () {
@@ -63,7 +63,7 @@ class Structuring_Markup_Admin_List {
63
  if ( $row->activate === 'on' ) {
64
  $html = '<tr class="active"><td><span class="active">Enabled';
65
  } else {
66
- $html = '<tr><td><span class="stop">Disabled';
67
  }
68
  $html .= '</span></td>';
69
  $html .= '<td><a href="';
3
  * Schema.org Admin List
4
  *
5
  * @author Kazuya Takami
6
+ * @version 3.2.4
7
  * @since 1.0.0
8
  * @see wp-structuring-admin-db.php
9
  */
32
  /**
33
  * LIST Page HTML Render.
34
  *
35
+ * @version 3.2.4
36
  * @since 1.0.0
37
  */
38
  private function page_render () {
63
  if ( $row->activate === 'on' ) {
64
  $html = '<tr class="active"><td><span class="active">Enabled';
65
  } else {
66
+ $html = '<tr class="stop"><td><span class="stop">Disabled';
67
  }
68
  $html .= '</span></td>';
69
  $html .= '<td><a href="';
includes/wp-structuring-admin-type-breadcrumb.php CHANGED
@@ -3,7 +3,7 @@
3
  * Schema.org Type Breadcrumb
4
  *
5
  * @author Kazuya Takami
6
- * @version 3.1.3
7
  * @since 2.0.0
8
  * @see wp-structuring-admin-db.php
9
  * @link https://schema.org/BreadcrumbList
@@ -28,7 +28,7 @@ class Structuring_Markup_Type_Breadcrumb {
28
  /**
29
  * Form Layout Render
30
  *
31
- * @version 2.5.1
32
  * @since 2.3.3
33
  * @param array $option
34
  */
@@ -45,7 +45,7 @@ class Structuring_Markup_Type_Breadcrumb {
45
  $html .= '</td></tr>';
46
  $html .= '<tr><th><label for="home_name">Home Name :</label></th><td>';
47
  $html .= '<input type="text" name="option[' . "home_name" . ']" id="home_name" class="regular-text" value="' . esc_attr( $option['home_name'] ) . '">';
48
- $html .= '<small>Default : bloginfo("name")</small>';
49
  $html .= '</td></tr>';
50
  $html .= '</table>';
51
  echo $html;
3
  * Schema.org Type Breadcrumb
4
  *
5
  * @author Kazuya Takami
6
+ * @version 3.2.4
7
  * @since 2.0.0
8
  * @see wp-structuring-admin-db.php
9
  * @link https://schema.org/BreadcrumbList
28
  /**
29
  * Form Layout Render
30
  *
31
+ * @version 3.2.4
32
  * @since 2.3.3
33
  * @param array $option
34
  */
45
  $html .= '</td></tr>';
46
  $html .= '<tr><th><label for="home_name">Home Name :</label></th><td>';
47
  $html .= '<input type="text" name="option[' . "home_name" . ']" id="home_name" class="regular-text" value="' . esc_attr( $option['home_name'] ) . '">';
48
+ $html .= '<small>Default : bloginfo("name")<br>* In the case of the pattern set for the static page on the front page its title is the default value.</small>';
49
  $html .= '</td></tr>';
50
  $html .= '</table>';
51
  echo $html;
includes/wp-structuring-admin-type-event.php CHANGED
@@ -3,7 +3,7 @@
3
  * Schema.org Type Event
4
  *
5
  * @author Kazuya Takami
6
- * @version 3.1.3
7
  * @since 2.1.0
8
  * @see wp-structuring-admin-db.php
9
  * @link http://schema.org/Event
@@ -25,7 +25,7 @@ class Structuring_Markup_Type_Event {
25
  /**
26
  * Form Layout Render
27
  *
28
- * @version 3.1.3
29
  * @since 2.1.0
30
  */
31
  private function page_render () {
@@ -33,7 +33,10 @@ class Structuring_Markup_Type_Event {
33
  $html .= '<caption>Basic Setting</caption>';
34
  $html .= '<tr><th class="require">type :</th><td><small>Select a event type: field name "schema_event_type"</small></td></tr>';
35
  $html .= '<tr><th class="require">name :</th><td><small>Input a custom post: field name "schema_event_name"</small></td></tr>';
 
 
36
  $html .= '<tr><th class="require">startDate :</th><td><small>Input a custom post: field name "schema_event_date" & "schema_event_time"</small></td></tr>';
 
37
  $html .= '<tr><th>url :</th><td><small>Input a custom post: field name "schema_event_url"</small></td></tr>';
38
  $html .= '</table>';
39
  echo $html;
3
  * Schema.org Type Event
4
  *
5
  * @author Kazuya Takami
6
+ * @version 3.2.4
7
  * @since 2.1.0
8
  * @see wp-structuring-admin-db.php
9
  * @link http://schema.org/Event
25
  /**
26
  * Form Layout Render
27
  *
28
+ * @version 3.2.4
29
  * @since 2.1.0
30
  */
31
  private function page_render () {
33
  $html .= '<caption>Basic Setting</caption>';
34
  $html .= '<tr><th class="require">type :</th><td><small>Select a event type: field name "schema_event_type"</small></td></tr>';
35
  $html .= '<tr><th class="require">name :</th><td><small>Input a custom post: field name "schema_event_name"</small></td></tr>';
36
+ $html .= '<tr><th class="require">description :</th><td><small>Input a custom post: field name "schema_event_description"</small></td></tr>';
37
+ $html .= '<tr><th class="require">image :</th><td><small>Input a custom post: field name "schema_event_image"</small></td></tr>';
38
  $html .= '<tr><th class="require">startDate :</th><td><small>Input a custom post: field name "schema_event_date" & "schema_event_time"</small></td></tr>';
39
+ $html .= '<tr><th class="require">endtDate :</th><td><small>Input a custom post: field name "schema_event_date_end" & "schema_event_time_end"</small></td></tr>';
40
  $html .= '<tr><th>url :</th><td><small>Input a custom post: field name "schema_event_url"</small></td></tr>';
41
  $html .= '</table>';
42
  echo $html;
includes/wp-structuring-display.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author Kazuya Takami
6
  * @author Justin Frydman
7
- * @version 3.2.3
8
  * @since 1.0.0
9
  */
10
  class Structuring_Markup_Display {
@@ -212,7 +212,7 @@ class Structuring_Markup_Display {
212
  /**
213
  * Setting schema.org Article
214
  *
215
- * @version 3.2.2
216
  * @since 1.1.0
217
  * @param array $options
218
  */
@@ -229,7 +229,7 @@ class Structuring_Markup_Display {
229
  "@type" => "WebPage",
230
  "@id" => get_permalink( $post->ID )
231
  ),
232
- "headline" => esc_html( $post->post_title ),
233
  "datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
234
  "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
235
  "author" => array(
@@ -289,7 +289,7 @@ class Structuring_Markup_Display {
289
  /**
290
  * Setting schema.org BlogPosting
291
  *
292
- * @version 3.2.2
293
  * @since 1.2.0
294
  * @param array $options
295
  */
@@ -306,7 +306,7 @@ class Structuring_Markup_Display {
306
  "@type" => "WebPage",
307
  "@id" => get_permalink( $post->ID )
308
  ),
309
- "headline" => esc_html( $post->post_title ),
310
  "datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
311
  "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
312
  "author" => array(
@@ -583,7 +583,7 @@ class Structuring_Markup_Display {
583
  /**
584
  * Setting schema.org NewsArticle
585
  *
586
- * @version 3.2.2
587
  * @since 1.0.0
588
  * @param array $options
589
  */
@@ -600,7 +600,7 @@ class Structuring_Markup_Display {
600
  "@type" => "WebPage",
601
  "@id" => get_permalink( $post->ID )
602
  ),
603
- "headline" => esc_html( $post->post_title ),
604
  "datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
605
  "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
606
  "author" => array(
4
  *
5
  * @author Kazuya Takami
6
  * @author Justin Frydman
7
+ * @version 3.2.4
8
  * @since 1.0.0
9
  */
10
  class Structuring_Markup_Display {
212
  /**
213
  * Setting schema.org Article
214
  *
215
+ * @version 3.2.4
216
  * @since 1.1.0
217
  * @param array $options
218
  */
229
  "@type" => "WebPage",
230
  "@id" => get_permalink( $post->ID )
231
  ),
232
+ "headline" => mb_substr( esc_html( $post->post_title ), 0, 110 ),
233
  "datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
234
  "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
235
  "author" => array(
289
  /**
290
  * Setting schema.org BlogPosting
291
  *
292
+ * @version 3.2.4
293
  * @since 1.2.0
294
  * @param array $options
295
  */
306
  "@type" => "WebPage",
307
  "@id" => get_permalink( $post->ID )
308
  ),
309
+ "headline" => mb_substr( esc_html( $post->post_title ), 0, 110 ),
310
  "datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
311
  "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
312
  "author" => array(
583
  /**
584
  * Setting schema.org NewsArticle
585
  *
586
+ * @version 3.2.4
587
  * @since 1.0.0
588
  * @param array $options
589
  */
600
  "@type" => "WebPage",
601
  "@id" => get_permalink( $post->ID )
602
  ),
603
+ "headline" => mb_substr( esc_html( $post->post_title ), 0, 110 ),
604
  "datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
605
  "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
606
  "author" => array(
includes/wp-structuring-short-code-breadcrumb.php CHANGED
@@ -3,7 +3,7 @@
3
  * Breadcrumb ShortCode Settings
4
  *
5
  * @author Kazuya Takami
6
- * @version 3.2.0
7
  * @since 2.0.0
8
  */
9
  class Structuring_Markup_ShortCode_Breadcrumb {
@@ -62,7 +62,7 @@ class Structuring_Markup_ShortCode_Breadcrumb {
62
  /**
63
  * Breadcrumb array setting.
64
  *
65
- * @version 3.2.0
66
  * @since 2.0.0
67
  * @access public
68
  * @param array $options
@@ -75,11 +75,22 @@ class Structuring_Markup_ShortCode_Breadcrumb {
75
  $item_array = array();
76
  $current_url = esc_url( home_url() . $_SERVER['REQUEST_URI'] );
77
 
78
- if ( isset( $options['home_on'] ) && $options['home_on'] === 'on' ) {
 
 
 
 
 
 
79
  if ( isset( $options['home_name'] ) && $options['home_name'] !== '' ) {
80
  $item_array[] = $this->set_schema_breadcrumb_item( home_url(), $options['home_name'] );
81
  } else {
82
- $item_array[] = $this->set_schema_breadcrumb_item( home_url(), get_bloginfo('name') );
 
 
 
 
 
83
  }
84
  }
85
 
@@ -106,7 +117,7 @@ class Structuring_Markup_ShortCode_Breadcrumb {
106
  $item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $categories->term_id ), $categories->name );
107
  } elseif ( is_author() ) {
108
  $item_array[] = $this->set_schema_breadcrumb_item( $current_url, get_the_author_meta( 'display_name', get_query_var( 'author' ) ) );
109
- } elseif ( is_page() ) {
110
  if( $post->post_parent !== 0 ) {
111
  $ancestors = array_reverse( get_post_ancestors( $post->ID ) );
112
  foreach( $ancestors as $ancestor ){
@@ -136,17 +147,31 @@ class Structuring_Markup_ShortCode_Breadcrumb {
136
  }
137
  }
138
  } elseif ( is_singular( 'post' ) ) {
139
- $categories = get_the_category( $post->ID );
140
- if ( isset( $categories[0] ) ) {
141
- $cat = $categories[0];
142
-
143
- if ( $cat->parent !== 0 ) {
144
- $ancestors = array_reverse( get_ancestors( $cat->cat_ID, 'category' ) );
145
- foreach ( $ancestors as $ancestor ) {
146
- $item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $ancestor ), get_cat_name( $ancestor ) );
 
 
 
 
 
 
147
  }
148
  }
149
- $item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $cat->term_id ), $cat->name );
 
 
 
 
 
 
 
 
150
  }
151
  $item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
152
  } elseif ( is_single() ) {
3
  * Breadcrumb ShortCode Settings
4
  *
5
  * @author Kazuya Takami
6
+ * @version 3.2.4
7
  * @since 2.0.0
8
  */
9
  class Structuring_Markup_ShortCode_Breadcrumb {
62
  /**
63
  * Breadcrumb array setting.
64
  *
65
+ * @version 3.2.4
66
  * @since 2.0.0
67
  * @access public
68
  * @param array $options
75
  $item_array = array();
76
  $current_url = esc_url( home_url() . $_SERVER['REQUEST_URI'] );
77
 
78
+ if ( get_option( 'show_on_front' ) == 'page' ) {
79
+ $front_page_id = get_option( 'page_on_front' );
80
+ } else {
81
+ $front_page_id = null;
82
+ }
83
+
84
+ if ( isset( $options['home_on'] ) && $options['home_on'] === 'on' ) {
85
  if ( isset( $options['home_name'] ) && $options['home_name'] !== '' ) {
86
  $item_array[] = $this->set_schema_breadcrumb_item( home_url(), $options['home_name'] );
87
  } else {
88
+ if ( is_null( $front_page_id ) ) {
89
+ $item_array[] = $this->set_schema_breadcrumb_item( home_url(), get_bloginfo( 'name' ) );
90
+ } else {
91
+ $front_page = get_post( $front_page_id );
92
+ $item_array[] = $this->set_schema_breadcrumb_item( home_url(), esc_html( $front_page->post_title ) );
93
+ }
94
  }
95
  }
96
 
117
  $item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $categories->term_id ), $categories->name );
118
  } elseif ( is_author() ) {
119
  $item_array[] = $this->set_schema_breadcrumb_item( $current_url, get_the_author_meta( 'display_name', get_query_var( 'author' ) ) );
120
+ } elseif ( is_page() && $front_page_id != $post->ID ) {
121
  if( $post->post_parent !== 0 ) {
122
  $ancestors = array_reverse( get_post_ancestors( $post->ID ) );
123
  foreach( $ancestors as $ancestor ){
147
  }
148
  }
149
  } elseif ( is_singular( 'post' ) ) {
150
+ $terms = get_the_terms( $post->ID, 'category' );
151
+ $term_bottom = array();
152
+
153
+ if ( $terms && ! is_wp_error( $terms ) ) {
154
+ $parent_ids = array();
155
+
156
+ foreach ( $terms as $term ) {
157
+ if ( $term->parent != 0 ) {
158
+ $parent_ids[] = $term->parent;
159
+ }
160
+ }
161
+ foreach ( $terms as $term ) {
162
+ if ( !in_array( $term->term_id, $parent_ids ) ) {
163
+ $term_bottom[] = $term->term_id;
164
  }
165
  }
166
+ }
167
+
168
+ if ( count( $term_bottom ) > 0 ) {
169
+ $ancestors = array_reverse( get_ancestors( $term_bottom[0], 'category' ) );
170
+ $ancestors[] = $term_bottom[0];
171
+
172
+ foreach ( $ancestors as $ancestor ) {
173
+ $item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $ancestor ), get_cat_name( $ancestor ) );
174
+ }
175
  }
176
  $item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
177
  } elseif ( is_single() ) {
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: miiitaka
3
  Tags: schema, schema.org, json, json-ld, seo, post, posts, google, shortcode, breadcrumb
4
  Requires at least: 4.3.1
5
  Tested up to: 4.7.3
6
- Stable tag: 3.2.3
7
 
8
  Allows you to include schema.org JSON-LD syntax markup on your website
9
 
@@ -54,6 +54,12 @@ if ( shortcode_exists( 'wp-structuring-markup-breadcrumb' ) ) {
54
 
55
  == Changelog ==
56
 
 
 
 
 
 
 
57
  = 3.2.3 (2017-03-21) =
58
  * Fixed : "Warning: Illegal string offset" error occurred on Video and Event Schema.org.
59
  * Updated : Event Types add fields.
3
  Tags: schema, schema.org, json, json-ld, seo, post, posts, google, shortcode, breadcrumb
4
  Requires at least: 4.3.1
5
  Tested up to: 4.7.3
6
+ Stable tag: 3.2.4
7
 
8
  Allows you to include schema.org JSON-LD syntax markup on your website
9
 
54
 
55
  == Changelog ==
56
 
57
+ = 3.2.4 (2017-03-30) =
58
+ * Fixed : BreadcrumbList - Ignore the Home setting when setting the head fixed page.
59
+ * Fixed : BreadcrumbList - Categories of two or more levels are not displayed.
60
+ * Fixed : Minor bug fixed.
61
+ * Updated : Article,BlogPosting and NewsArticle - Limit headline to 110 chars.
62
+
63
  = 3.2.3 (2017-03-21) =
64
  * Fixed : "Warning: Illegal string offset" error occurred on Video and Event Schema.org.
65
  * Updated : Event Types add fields.
wp-structuring-markup.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Markup (JSON-LD) structured in schema.org
4
  Plugin URI: https://github.com/miiitaka/wp-structuring-markup
5
  Description: Allows you to include schema.org JSON-LD syntax markup on your website
6
- Version: 3.2.3
7
  Author: Kazuya Takami
8
  Author URI: https://www.terakoya.work/
9
  License: GPLv2 or later
@@ -18,7 +18,7 @@ new Structuring_Markup();
18
  * Schema.org Basic Class
19
  *
20
  * @author Kazuya Takami
21
- * @version 3.2.3
22
  * @since 1.0.0
23
  */
24
  class Structuring_Markup {
@@ -26,11 +26,11 @@ class Structuring_Markup {
26
  /**
27
  * Variable definition.
28
  *
29
- * @version 3.2.3
30
  * @since 1.3.0
31
  */
32
  private $text_domain = 'wp-structuring-markup';
33
- private $version = '3.2.3';
34
 
35
  /**
36
  * Constructor Define.
3
  Plugin Name: Markup (JSON-LD) structured in schema.org
4
  Plugin URI: https://github.com/miiitaka/wp-structuring-markup
5
  Description: Allows you to include schema.org JSON-LD syntax markup on your website
6
+ Version: 3.2.4
7
  Author: Kazuya Takami
8
  Author URI: https://www.terakoya.work/
9
  License: GPLv2 or later
18
  * Schema.org Basic Class
19
  *
20
  * @author Kazuya Takami
21
+ * @version 3.2.4
22
  * @since 1.0.0
23
  */
24
  class Structuring_Markup {
26
  /**
27
  * Variable definition.
28
  *
29
+ * @version 3.2.4
30
  * @since 1.3.0
31
  */
32
  private $text_domain = 'wp-structuring-markup';
33
+ private $version = '3.2.4';
34
 
35
  /**
36
  * Constructor Define.