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

Version Description

Download this release

Release Info

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

Code changes from version 1.0.8 to 1.1.0

readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: miiitaka
3
  Tags: schema, json, seo, posts
4
  Requires at least: 4.3.1
5
  Tested up to: 4.3.1
6
- Stable tag: 1.0.8
7
 
8
  It is plug in to implement structured markup (JSON-LD syntax) by schema.org definition on an article or the fixed page.
9
 
@@ -21,11 +21,17 @@ Base knowledge is "https://developers.google.com/structured-data/"
21
 
22
  == Changelog ==
23
 
 
 
 
 
24
  = 1.0.1 - 1.0.8 =
25
- * Bug Fix.
 
26
 
27
  = 1.0.0 =
28
- * The first release.
 
29
 
30
  == Contact ==
31
 
3
  Tags: schema, json, seo, posts
4
  Requires at least: 4.3.1
5
  Tested up to: 4.3.1
6
+ Stable tag: 1.1.0
7
 
8
  It is plug in to implement structured markup (JSON-LD syntax) by schema.org definition on an article or the fixed page.
9
 
21
 
22
  == Changelog ==
23
 
24
+ = 1.1.0
25
+
26
+ * Schema.org Type "Article" Add.
27
+
28
  = 1.0.1 - 1.0.8 =
29
+
30
+ * Bug Fix. Missing plugin path setting.
31
 
32
  = 1.0.0 =
33
+
34
+ * First release of this plugin.
35
 
36
  == Contact ==
37
 
wp-structuring-admin-list.php CHANGED
@@ -3,7 +3,7 @@
3
  * Schema.org Admin List
4
  *
5
  * @author Kazuya Takami
6
- * @version 1.0.0
7
  * @since 1.0.0
8
  * @see wp-structuring-admin-db.php
9
  */
@@ -12,6 +12,7 @@ class Structuring_Markup_Admin_List {
12
  private $type_array = array(
13
  "website" => "Web Site",
14
  "organization" => "Organization",
 
15
  "news_article" => "News Article"
16
  );
17
 
3
  * Schema.org Admin List
4
  *
5
  * @author Kazuya Takami
6
+ * @version 1.1.0
7
  * @since 1.0.0
8
  * @see wp-structuring-admin-db.php
9
  */
12
  private $type_array = array(
13
  "website" => "Web Site",
14
  "organization" => "Organization",
15
+ "article" => "Article",
16
  "news_article" => "News Article"
17
  );
18
 
wp-structuring-admin-post.php CHANGED
@@ -3,7 +3,7 @@
3
  * Schema.org Admin Post
4
  *
5
  * @author Kazuya Takami
6
- * @version 1.0.0
7
  * @since 1.0.0
8
  */
9
  class Structuring_Markup_Admin_Post {
@@ -12,6 +12,7 @@ class Structuring_Markup_Admin_Post {
12
  private $type_array = array(
13
  array("type" => "website", "display" => "Web Site"),
14
  array("type" => "organization", "display" => "Organization"),
 
15
  array("type" => "news_article", "display" => "News Article")
16
  );
17
 
@@ -95,7 +96,8 @@ class Structuring_Markup_Admin_Post {
95
  /**
96
  * Setting Page of the Admin Screen.
97
  *
98
- * @since 1.0.0
 
99
  * @param array $options
100
  * @param string $mode
101
  * @param string $status
@@ -171,6 +173,14 @@ class Structuring_Markup_Admin_Post {
171
  require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-organization.php' );
172
  new Structuring_Markup_Type_Organization( $options['option'] );
173
  break;
 
 
 
 
 
 
 
 
174
  case 'news_article':
175
  $this->output_checkbox_render( $options['output'], "post", "Post", "Post Page" );
176
  $html = '</td></tr></table><hr>';
3
  * Schema.org Admin Post
4
  *
5
  * @author Kazuya Takami
6
+ * @version 1.1.0
7
  * @since 1.0.0
8
  */
9
  class Structuring_Markup_Admin_Post {
12
  private $type_array = array(
13
  array("type" => "website", "display" => "Web Site"),
14
  array("type" => "organization", "display" => "Organization"),
15
+ array("type" => "article", "display" => "Article"),
16
  array("type" => "news_article", "display" => "News Article")
17
  );
18
 
96
  /**
97
  * Setting Page of the Admin Screen.
98
  *
99
+ * @since 1.0.0
100
+ * @version 1.1.0
101
  * @param array $options
102
  * @param string $mode
103
  * @param string $status
173
  require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-organization.php' );
174
  new Structuring_Markup_Type_Organization( $options['option'] );
175
  break;
176
+ case 'article':
177
+ $this->output_checkbox_render( $options['output'], "post", "Post", "Post Page" );
178
+ $html = '</td></tr></table><hr>';
179
+ echo $html;
180
+
181
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-article.php' );
182
+ new Structuring_Markup_Type_Article();
183
+ break;
184
  case 'news_article':
185
  $this->output_checkbox_render( $options['output'], "post", "Post", "Post Page" );
186
  $html = '</td></tr></table><hr>';
wp-structuring-admin-type-article.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Article
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 1.1.0
7
+ * @since 1.1.0
8
+ * @see wp-structuring-admin-db.php
9
+ * @link http://schema.org/Article
10
+ */
11
+ class Structuring_Markup_Type_Article {
12
+
13
+ /**
14
+ * Constructor Define.
15
+ *
16
+ * @since 1.1.0
17
+ */
18
+ public function __construct()
19
+ {
20
+ $this->page_render();
21
+ }
22
+
23
+ /**
24
+ * Form Layout Render
25
+ *
26
+ * @since 1.1.0
27
+ */
28
+ private function page_render()
29
+ {
30
+ $html = '<table class="schema-admin-table">';
31
+ $html .= '<caption>Basic Setting( Post Page Only )</caption>';
32
+ $html .= '<tr><th>headline :</th><td><small>Default : post_title</small></td></tr>';
33
+ $html .= '<tr><th>datePublished :</th><td><small>Default : get_the_time( DATE_ISO8601, ID )</small></td></tr>';
34
+ $html .= '<tr><th>author :</th><td><small>Default : get_the_author_meta( "display_name", author_ID )</small></td></tr>';
35
+ $html .= '<tr><th>image :</th><td><small>Default : thumbnail</small></td></tr>';
36
+ $html .= '<tr><th>description :</th><td><small>Default : post_excerpt</small></td></tr>';
37
+ $html .= '<tr><th>articleBody :</th><td><small>Default : post_content</small></td></tr>';
38
+ $html .= '</table>';
39
+ echo $html;
40
+
41
+ submit_button();
42
+ }
43
+ }
wp-structuring-display.php CHANGED
@@ -40,9 +40,10 @@ class Structuring_Markup_Display {
40
  /**
41
  * Setting JSON-LD Template
42
  *
43
- * @since 1.0.0
44
- * @param string $output
45
- * @param Structuring_Markup_Admin_Db $db
 
46
  */
47
  private function get_schema_data( Structuring_Markup_Admin_Db $db, $output ) {
48
  $results = $db->get_select_options( $output );
@@ -61,6 +62,11 @@ class Structuring_Markup_Display {
61
  $this->set_schema_organization( unserialize( $row->options ) );
62
  }
63
  break;
 
 
 
 
 
64
  case 'news_article':
65
  if ( isset( $row->options ) ) {
66
  $this->set_schema_news_article( unserialize( $row->options ) );
@@ -153,6 +159,34 @@ class Structuring_Markup_Display {
153
  $this->set_schema_json( $args );
154
  }
155
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  /**
157
  * Setting schema.org NewsArticle
158
  *
40
  /**
41
  * Setting JSON-LD Template
42
  *
43
+ * @since 1.0.0
44
+ * @version 1.1.0
45
+ * @param Structuring_Markup_Admin_Db $db
46
+ * @param string $output
47
  */
48
  private function get_schema_data( Structuring_Markup_Admin_Db $db, $output ) {
49
  $results = $db->get_select_options( $output );
62
  $this->set_schema_organization( unserialize( $row->options ) );
63
  }
64
  break;
65
+ case 'article':
66
+ if ( isset( $row->options ) ) {
67
+ $this->set_schema_article( unserialize( $row->options ) );
68
+ }
69
+ break;
70
  case 'news_article':
71
  if ( isset( $row->options ) ) {
72
  $this->set_schema_news_article( unserialize( $row->options ) );
159
  $this->set_schema_json( $args );
160
  }
161
 
162
+ /**
163
+ * Setting schema.org Article
164
+ *
165
+ * @since 1.1.0
166
+ * @version 1.1.0
167
+ */
168
+ private function set_schema_article() {
169
+ global $post;
170
+
171
+ $args = array(
172
+ "@context" => "http://schema.org",
173
+ "@type" => "Article",
174
+ "headline" => esc_html( $post->post_title ),
175
+ "datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
176
+ "author" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) ),
177
+ "description" => esc_html( $post->post_excerpt ),
178
+ "articleBody" => esc_html( $post->post_content )
179
+ );
180
+
181
+ if ( has_post_thumbnail( $post->ID ) ) {
182
+ list( $thumbnail_url, $thumbnail_width, $thumbnail_height ) = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
183
+ $args = array(
184
+ "image" => array( $thumbnail_url ),
185
+ );
186
+ }
187
+ $this->set_schema_json( $args );
188
+ }
189
+
190
  /**
191
  * Setting schema.org NewsArticle
192
  *
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: It is plug in to implement structured markup (JSON-LD syntax) by schema.org definition on an article or the fixed page.
6
- Version: 1.0.8
7
  Author: Kazuya Takami
8
  Author URI: http://programp.com/
9
  License: GPLv2 or later
@@ -27,7 +27,7 @@ class Structuring_Markup {
27
  *
28
  * @since 1.0.0
29
  */
30
- function __construct() {
31
  $db = new Structuring_Markup_Admin_Db();
32
  $db->create_table();
33
 
3
  Plugin Name: Markup (JSON-LD) structured in schema.org
4
  Plugin URI: https://github.com/miiitaka/wp-structuring-markup
5
  Description: It is plug in to implement structured markup (JSON-LD syntax) by schema.org definition on an article or the fixed page.
6
+ Version: 1.1.0
7
  Author: Kazuya Takami
8
  Author URI: http://programp.com/
9
  License: GPLv2 or later
27
  *
28
  * @since 1.0.0
29
  */
30
+ public function __construct() {
31
  $db = new Structuring_Markup_Admin_Db();
32
  $db->create_table();
33