Version Description
(2017-07-03) = * Added : If there is no feature image setting, set the first image of the post. * Updated : Oganization Image recommended.(Article / NewsArticle / BlogPosting) * Fixed : Events and videos of custom posts should not appear in choices. * Fixed : Organization type Notice Error.
Download this release
Release Info
Developer | miiitaka |
Plugin | Markup (JSON-LD) structured in schema.org |
Version | 4.1.0 |
Comparing to | |
See all releases |
Code changes from version 4.0.2 to 4.1.0
- includes/admin/wp-structuring-admin-post.php +2 -5
- includes/admin/wp-structuring-admin-type-article.php +15 -7
- includes/admin/wp-structuring-admin-type-blog-posting.php +14 -6
- includes/admin/wp-structuring-admin-type-news-article.php +15 -7
- includes/admin/wp-structuring-admin-type-organization.php +11 -9
- includes/meta/wp-structuring-meta-article.php +36 -26
- includes/meta/wp-structuring-meta-blog-posting.php +36 -25
- includes/meta/wp-structuring-meta-news-article.php +36 -25
- includes/wp-structuring-utility.php +24 -1
- readme.txt +7 -1
- wp-structuring-markup.php +4 -4
includes/admin/wp-structuring-admin-post.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Schema.org Admin Post
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
7 |
* @since 1.0.0
|
8 |
*/
|
9 |
class Structuring_Markup_Admin_Post {
|
@@ -44,7 +44,7 @@ class Structuring_Markup_Admin_Post {
|
|
44 |
/**
|
45 |
* Constructor Define.
|
46 |
*
|
47 |
-
* @version 4.0
|
48 |
* @since 1.0.0
|
49 |
* @param String $text_domain
|
50 |
*/
|
@@ -55,9 +55,6 @@ class Structuring_Markup_Admin_Post {
|
|
55 |
);
|
56 |
$post_types = get_post_types( $args, 'objects' );
|
57 |
|
58 |
-
unset( $post_types['schema_event_post'] );
|
59 |
-
unset( $post_types['schema_video_post'] );
|
60 |
-
|
61 |
foreach ( $post_types as $post_type ) {
|
62 |
$this->post_args[] = array(
|
63 |
'label' => esc_html( $post_type->label ),
|
3 |
* Schema.org Admin Post
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 4.1.0
|
7 |
* @since 1.0.0
|
8 |
*/
|
9 |
class Structuring_Markup_Admin_Post {
|
44 |
/**
|
45 |
* Constructor Define.
|
46 |
*
|
47 |
+
* @version 4.1.0
|
48 |
* @since 1.0.0
|
49 |
* @param String $text_domain
|
50 |
*/
|
55 |
);
|
56 |
$post_types = get_post_types( $args, 'objects' );
|
57 |
|
|
|
|
|
|
|
58 |
foreach ( $post_types as $post_type ) {
|
59 |
$this->post_args[] = array(
|
60 |
'label' => esc_html( $post_type->label ),
|
includes/admin/wp-structuring-admin-type-article.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Schema.org Type Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version
|
7 |
* @since 1.1.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link http://schema.org/Article
|
@@ -32,7 +32,7 @@ class Structuring_Markup_Type_Article {
|
|
32 |
/**
|
33 |
* Form Layout Render
|
34 |
*
|
35 |
-
* @version
|
36 |
* @since 1.1.0
|
37 |
* @param array $option
|
38 |
*/
|
@@ -59,6 +59,13 @@ class Structuring_Markup_Type_Article {
|
|
59 |
$html .= '<tr><th>url :</th><td><small>Default : Featured Image</small></td></tr>';
|
60 |
$html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
|
61 |
$html .= '<tr><th>width :</th><td><small>Auto : The width of the image, in pixels. Images should be at least 696 pixels wide.</small></td></tr>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
$html .= '</table>';
|
63 |
echo $html;
|
64 |
|
@@ -105,15 +112,16 @@ class Structuring_Markup_Type_Article {
|
|
105 |
/**
|
106 |
* Return the default options array
|
107 |
*
|
108 |
-
* @since
|
109 |
* @version 2.2.0
|
110 |
* @return array $args
|
111 |
*/
|
112 |
private function get_default_options () {
|
113 |
-
$args['name']
|
114 |
-
$args['
|
115 |
-
$args['logo
|
116 |
-
$args['logo-
|
|
|
117 |
|
118 |
return (array) $args;
|
119 |
}
|
3 |
* Schema.org Type Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 4.1.0
|
7 |
* @since 1.1.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link http://schema.org/Article
|
32 |
/**
|
33 |
* Form Layout Render
|
34 |
*
|
35 |
+
* @version 4.1.0
|
36 |
* @since 1.1.0
|
37 |
* @param array $option
|
38 |
*/
|
59 |
$html .= '<tr><th>url :</th><td><small>Default : Featured Image</small></td></tr>';
|
60 |
$html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
|
61 |
$html .= '<tr><th>width :</th><td><small>Auto : The width of the image, in pixels. Images should be at least 696 pixels wide.</small></td></tr>';
|
62 |
+
$html .= '<tr><th><label for="content_image">Setting image url :</label></th><td>';
|
63 |
+
$html .= '<input type="checkbox" name="option[' . "content_image" . ']" id="content_image" value="on"';
|
64 |
+
if ( isset( $option['content_image'] ) && $option['content_image'] === 'on' ) {
|
65 |
+
$html .= ' checked="checked"';
|
66 |
+
}
|
67 |
+
$html .= '>Set the first image in the content.<br><small>Pattern without feature image set (feature image takes precedence)</small>';
|
68 |
+
$html .= '</td></tr>';
|
69 |
$html .= '</table>';
|
70 |
echo $html;
|
71 |
|
112 |
/**
|
113 |
* Return the default options array
|
114 |
*
|
115 |
+
* @since 4.1.0
|
116 |
* @version 2.2.0
|
117 |
* @return array $args
|
118 |
*/
|
119 |
private function get_default_options () {
|
120 |
+
$args['name'] = get_bloginfo('name');
|
121 |
+
$args['content_image'] = '';
|
122 |
+
$args['logo'] = '';
|
123 |
+
$args['logo-height'] = 0;
|
124 |
+
$args['logo-width'] = 0;
|
125 |
|
126 |
return (array) $args;
|
127 |
}
|
includes/admin/wp-structuring-admin-type-blog-posting.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Schema.org Type BlogPosting
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version
|
7 |
* @since 1.2.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link http://schema.org/BlogPosting
|
@@ -32,7 +32,7 @@ class Structuring_Markup_Type_Blog_Posting {
|
|
32 |
/**
|
33 |
* Form Layout Render
|
34 |
*
|
35 |
-
* @version
|
36 |
* @since 1.2.0
|
37 |
* @param array $option
|
38 |
*/
|
@@ -59,6 +59,13 @@ class Structuring_Markup_Type_Blog_Posting {
|
|
59 |
$html .= '<tr><th>url :</th><td><small>Default : Featured Image</small></td></tr>';
|
60 |
$html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
|
61 |
$html .= '<tr><th>width :</th><td><small>Auto : The width of the image, in pixels. Images should be at least 696 pixels wide.</small></td></tr>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
$html .= '</table>';
|
63 |
echo $html;
|
64 |
|
@@ -110,10 +117,11 @@ class Structuring_Markup_Type_Blog_Posting {
|
|
110 |
* @return array $args
|
111 |
*/
|
112 |
private function get_default_options () {
|
113 |
-
$args['name']
|
114 |
-
$args['
|
115 |
-
$args['logo
|
116 |
-
$args['logo-
|
|
|
117 |
|
118 |
return (array) $args;
|
119 |
}
|
3 |
* Schema.org Type BlogPosting
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 4.1.0
|
7 |
* @since 1.2.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link http://schema.org/BlogPosting
|
32 |
/**
|
33 |
* Form Layout Render
|
34 |
*
|
35 |
+
* @version 4.1.0
|
36 |
* @since 1.2.0
|
37 |
* @param array $option
|
38 |
*/
|
59 |
$html .= '<tr><th>url :</th><td><small>Default : Featured Image</small></td></tr>';
|
60 |
$html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
|
61 |
$html .= '<tr><th>width :</th><td><small>Auto : The width of the image, in pixels. Images should be at least 696 pixels wide.</small></td></tr>';
|
62 |
+
$html .= '<tr><th><label for="content_image">Setting image url :</label></th><td>';
|
63 |
+
$html .= '<input type="checkbox" name="option[' . "content_image" . ']" id="content_image" value="on"';
|
64 |
+
if ( isset( $option['content_image'] ) && $option['content_image'] === 'on' ) {
|
65 |
+
$html .= ' checked="checked"';
|
66 |
+
}
|
67 |
+
$html .= '>Set the first image in the content.<br><small>Pattern without feature image set (feature image takes precedence)</small>';
|
68 |
+
$html .= '</td></tr>';
|
69 |
$html .= '</table>';
|
70 |
echo $html;
|
71 |
|
117 |
* @return array $args
|
118 |
*/
|
119 |
private function get_default_options () {
|
120 |
+
$args['name'] = get_bloginfo('name');
|
121 |
+
$args['content_image'] = '';
|
122 |
+
$args['logo'] = '';
|
123 |
+
$args['logo-height'] = 0;
|
124 |
+
$args['logo-width'] = 0;
|
125 |
|
126 |
return (array) $args;
|
127 |
}
|
includes/admin/wp-structuring-admin-type-news-article.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Schema.org Type News Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version
|
7 |
* @since 1.0.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link http://schema.org/NewsArticle
|
@@ -32,7 +32,7 @@ class Structuring_Markup_Type_NewsArticle {
|
|
32 |
/**
|
33 |
* Form Layout Render
|
34 |
*
|
35 |
-
* @version
|
36 |
* @since 1.0.0
|
37 |
* @param array $option
|
38 |
*/
|
@@ -59,6 +59,13 @@ class Structuring_Markup_Type_NewsArticle {
|
|
59 |
$html .= '<tr><th>url :</th><td><small>Default : thumbnail</small></td></tr>';
|
60 |
$html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
|
61 |
$html .= '<tr><th>width :</th><td><small>Auto : The width of the image, in pixels. Images should be at least 696 pixels wide.</small></td></tr>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
$html .= '</table>';
|
63 |
echo $html;
|
64 |
|
@@ -105,15 +112,16 @@ class Structuring_Markup_Type_NewsArticle {
|
|
105 |
/**
|
106 |
* Return the default options array
|
107 |
*
|
108 |
-
* @since
|
109 |
* @version 2.2.0
|
110 |
* @return array $args
|
111 |
*/
|
112 |
private function get_default_options () {
|
113 |
-
$args['name']
|
114 |
-
$args['
|
115 |
-
$args['logo
|
116 |
-
$args['logo-
|
|
|
117 |
|
118 |
return (array) $args;
|
119 |
}
|
3 |
* Schema.org Type News Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 4.1.0
|
7 |
* @since 1.0.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link http://schema.org/NewsArticle
|
32 |
/**
|
33 |
* Form Layout Render
|
34 |
*
|
35 |
+
* @version 4.1.0
|
36 |
* @since 1.0.0
|
37 |
* @param array $option
|
38 |
*/
|
59 |
$html .= '<tr><th>url :</th><td><small>Default : thumbnail</small></td></tr>';
|
60 |
$html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
|
61 |
$html .= '<tr><th>width :</th><td><small>Auto : The width of the image, in pixels. Images should be at least 696 pixels wide.</small></td></tr>';
|
62 |
+
$html .= '<tr><th><label for="content_image">Setting image url :</label></th><td>';
|
63 |
+
$html .= '<input type="checkbox" name="option[' . "content_image" . ']" id="content_image" value="on"';
|
64 |
+
if ( isset( $option['content_image'] ) && $option['content_image'] === 'on' ) {
|
65 |
+
$html .= ' checked="checked"';
|
66 |
+
}
|
67 |
+
$html .= '>Set the first image in the content.<br><small>Pattern without feature image set (feature image takes precedence)</small>';
|
68 |
+
$html .= '</td></tr>';
|
69 |
$html .= '</table>';
|
70 |
echo $html;
|
71 |
|
112 |
/**
|
113 |
* Return the default options array
|
114 |
*
|
115 |
+
* @since 4.1.0
|
116 |
* @version 2.2.0
|
117 |
* @return array $args
|
118 |
*/
|
119 |
private function get_default_options () {
|
120 |
+
$args['name'] = get_bloginfo('name');
|
121 |
+
$args['content_image'] = '';
|
122 |
+
$args['logo'] = '';
|
123 |
+
$args['logo-height'] = 0;
|
124 |
+
$args['logo-width'] = 0;
|
125 |
|
126 |
return (array) $args;
|
127 |
}
|
includes/admin/wp-structuring-admin-type-organization.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Schema.org Type Organization
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version
|
7 |
* @since 1.0.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link https://schema.org/Organization
|
@@ -48,15 +48,18 @@ class Structuring_Markup_Type_Organization {
|
|
48 |
/**
|
49 |
* Constructor Define.
|
50 |
*
|
51 |
-
* @
|
52 |
-
* @
|
|
|
53 |
*/
|
54 |
public function __construct ( array $option ) {
|
55 |
/** Default Value Set */
|
56 |
-
|
57 |
-
|
|
|
|
|
58 |
}
|
59 |
-
$this->page_render( $
|
60 |
}
|
61 |
|
62 |
/**
|
@@ -157,12 +160,11 @@ class Structuring_Markup_Type_Organization {
|
|
157 |
/**
|
158 |
* Return the default options array
|
159 |
*
|
160 |
-
* @version
|
161 |
* @since 1.0.0
|
162 |
-
* @param array $args
|
163 |
* @return array $args
|
164 |
*/
|
165 |
-
private function get_default_options (
|
166 |
$args['name'] = get_bloginfo('name');
|
167 |
$args['url'] = get_bloginfo('url');
|
168 |
$args['logo'] = get_bloginfo('url') . '/images/logo.png';
|
3 |
* Schema.org Type Organization
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 4.1.0
|
7 |
* @since 1.0.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link https://schema.org/Organization
|
48 |
/**
|
49 |
* Constructor Define.
|
50 |
*
|
51 |
+
* @version 4.1.0
|
52 |
+
* @since 1.0.0
|
53 |
+
* @param array $option
|
54 |
*/
|
55 |
public function __construct ( array $option ) {
|
56 |
/** Default Value Set */
|
57 |
+
$option_array = $this->get_default_options();
|
58 |
+
|
59 |
+
if ( !empty( $option ) ) {
|
60 |
+
$option_array = array_merge( $option_array, $option );
|
61 |
}
|
62 |
+
$this->page_render( $option_array );
|
63 |
}
|
64 |
|
65 |
/**
|
160 |
/**
|
161 |
* Return the default options array
|
162 |
*
|
163 |
+
* @version 4.1.0
|
164 |
* @since 1.0.0
|
|
|
165 |
* @return array $args
|
166 |
*/
|
167 |
+
private function get_default_options () {
|
168 |
$args['name'] = get_bloginfo('name');
|
169 |
$args['url'] = get_bloginfo('url');
|
170 |
$args['logo'] = get_bloginfo('url') . '/images/logo.png';
|
includes/meta/wp-structuring-meta-article.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Schema.org Type Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
7 |
* @since 4.0.0
|
8 |
* @link http://schema.org/Article
|
9 |
* @link https://developers.google.com/search/docs/data-types/articles
|
@@ -32,7 +32,7 @@ class Structuring_Markup_Meta_Article {
|
|
32 |
/**
|
33 |
* Setting schema.org Article
|
34 |
*
|
35 |
-
* @version 4.
|
36 |
* @since 4.0.0
|
37 |
* @param array $options
|
38 |
* @return array $args
|
@@ -71,37 +71,47 @@ class Structuring_Markup_Meta_Article {
|
|
71 |
)
|
72 |
);
|
73 |
$args = array_merge( $args, $images_args );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
|
79 |
-
$publisher_args = array(
|
80 |
-
"publisher" => array(
|
81 |
-
"@type" => "Organization",
|
82 |
-
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
|
83 |
-
"logo" => array(
|
84 |
-
"@type" => "ImageObject",
|
85 |
-
"url" => $options['logo'],
|
86 |
-
"width" => $logo['width'],
|
87 |
-
"height" => $logo['height']
|
88 |
-
)
|
89 |
-
)
|
90 |
-
);
|
91 |
-
$args = array_merge( $args, $publisher_args );
|
92 |
-
} else if ( !empty( $options['logo'] ) ) {
|
93 |
$publisher_args = array(
|
94 |
"publisher" => array(
|
95 |
"@type" => "Organization",
|
96 |
-
"name" =>
|
97 |
-
"logo" => array(
|
98 |
-
"@type" => "ImageObject",
|
99 |
-
"url" => $options['logo'],
|
100 |
-
"width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
|
101 |
-
"height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
|
102 |
-
)
|
103 |
)
|
104 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
$args = array_merge( $args, $publisher_args );
|
106 |
}
|
107 |
|
3 |
* Schema.org Type Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 4.1.0
|
7 |
* @since 4.0.0
|
8 |
* @link http://schema.org/Article
|
9 |
* @link https://developers.google.com/search/docs/data-types/articles
|
32 |
/**
|
33 |
* Setting schema.org Article
|
34 |
*
|
35 |
+
* @version 4.1.0
|
36 |
* @since 4.0.0
|
37 |
* @param array $options
|
38 |
* @return array $args
|
71 |
)
|
72 |
);
|
73 |
$args = array_merge( $args, $images_args );
|
74 |
+
} elseif ( isset( $options['content_image'] ) && $options['content_image'] === 'on' ) {
|
75 |
+
if ( $images = $this->utility->get_content_image( $post->post_content ) ) {
|
76 |
+
if ( $size = $this->utility->get_image_dimensions( $images ) ) {
|
77 |
+
$images_args = array(
|
78 |
+
"image" => array(
|
79 |
+
"@type" => "ImageObject",
|
80 |
+
"url" => $images,
|
81 |
+
"width" => $size['width'],
|
82 |
+
"height" => $size['height']
|
83 |
+
)
|
84 |
+
);
|
85 |
+
$args = array_merge( $args, $images_args );
|
86 |
+
}
|
87 |
+
}
|
88 |
}
|
89 |
|
90 |
+
if ( isset( $options['name'] ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
$publisher_args = array(
|
92 |
"publisher" => array(
|
93 |
"@type" => "Organization",
|
94 |
+
"name" => esc_html( $options['name'] ),
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
)
|
96 |
);
|
97 |
+
|
98 |
+
$options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
|
99 |
+
|
100 |
+
if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
|
101 |
+
$publisher_args['publisher']['logo'] = array(
|
102 |
+
"@type" => "ImageObject",
|
103 |
+
"url" => $options['logo'],
|
104 |
+
"width" => $logo['width'],
|
105 |
+
"height" => $logo['height']
|
106 |
+
);
|
107 |
+
} else if ( !empty( $options['logo'] ) ) {
|
108 |
+
$publisher_args['publisher']['logo'] = array(
|
109 |
+
"@type" => "ImageObject",
|
110 |
+
"url" => $options['logo'],
|
111 |
+
"width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
|
112 |
+
"height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
|
113 |
+
);
|
114 |
+
}
|
115 |
$args = array_merge( $args, $publisher_args );
|
116 |
}
|
117 |
|
includes/meta/wp-structuring-meta-blog-posting.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Schema.org Type BlogPosting
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
7 |
* @since 4.0.0
|
8 |
* @link http://schema.org/BlogPosting
|
9 |
* @link https://developers.google.com/search/docs/data-types/articles
|
@@ -32,7 +32,7 @@ class Structuring_Markup_Meta_Blog_Posting {
|
|
32 |
/**
|
33 |
* Setting schema.org BlogPosting
|
34 |
*
|
35 |
-
* @version 4.
|
36 |
* @since 4.0.0
|
37 |
* @param array $options
|
38 |
* @return array $args
|
@@ -72,36 +72,47 @@ class Structuring_Markup_Meta_Blog_Posting {
|
|
72 |
)
|
73 |
);
|
74 |
$args = array_merge( $args, $images_args );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
|
77 |
-
|
78 |
-
if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
|
79 |
$publisher_args = array(
|
80 |
"publisher" => array(
|
81 |
"@type" => "Organization",
|
82 |
-
"name" =>
|
83 |
-
"logo" => array(
|
84 |
-
"@type" => "ImageObject",
|
85 |
-
"url" => $options['logo'],
|
86 |
-
"width" => $logo['width'],
|
87 |
-
"height" => $logo['height']
|
88 |
-
)
|
89 |
-
)
|
90 |
-
);
|
91 |
-
$args = array_merge( $args, $publisher_args );
|
92 |
-
} else if ( !empty( $options['logo'] ) ) {
|
93 |
-
$publisher_args = array(
|
94 |
-
"publisher" => array(
|
95 |
-
"@type" => "Organization",
|
96 |
-
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
|
97 |
-
"logo" => array(
|
98 |
-
"@type" => "ImageObject",
|
99 |
-
"url" => $options['logo'],
|
100 |
-
"width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
|
101 |
-
"height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
|
102 |
-
)
|
103 |
)
|
104 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
$args = array_merge( $args, $publisher_args );
|
106 |
}
|
107 |
|
3 |
* Schema.org Type BlogPosting
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 4.1.0
|
7 |
* @since 4.0.0
|
8 |
* @link http://schema.org/BlogPosting
|
9 |
* @link https://developers.google.com/search/docs/data-types/articles
|
32 |
/**
|
33 |
* Setting schema.org BlogPosting
|
34 |
*
|
35 |
+
* @version 4.1.0
|
36 |
* @since 4.0.0
|
37 |
* @param array $options
|
38 |
* @return array $args
|
72 |
)
|
73 |
);
|
74 |
$args = array_merge( $args, $images_args );
|
75 |
+
} elseif ( isset( $options['content_image'] ) && $options['content_image'] === 'on' ) {
|
76 |
+
if ( $images = $this->utility->get_content_image( $post->post_content ) ) {
|
77 |
+
if ( $size = $this->utility->get_image_dimensions( $images ) ) {
|
78 |
+
$images_args = array(
|
79 |
+
"image" => array(
|
80 |
+
"@type" => "ImageObject",
|
81 |
+
"url" => $images,
|
82 |
+
"width" => $size['width'],
|
83 |
+
"height" => $size['height']
|
84 |
+
)
|
85 |
+
);
|
86 |
+
$args = array_merge( $args, $images_args );
|
87 |
+
}
|
88 |
+
}
|
89 |
}
|
90 |
|
91 |
+
if ( isset( $options['name'] ) ) {
|
|
|
92 |
$publisher_args = array(
|
93 |
"publisher" => array(
|
94 |
"@type" => "Organization",
|
95 |
+
"name" => esc_html( $options['name'] ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
)
|
97 |
);
|
98 |
+
|
99 |
+
$options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
|
100 |
+
|
101 |
+
if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
|
102 |
+
$publisher_args['publisher']['logo'] = array(
|
103 |
+
"@type" => "ImageObject",
|
104 |
+
"url" => $options['logo'],
|
105 |
+
"width" => $logo['width'],
|
106 |
+
"height" => $logo['height']
|
107 |
+
);
|
108 |
+
} else if ( !empty( $options['logo'] ) ) {
|
109 |
+
$publisher_args['publisher']['logo'] = array(
|
110 |
+
"@type" => "ImageObject",
|
111 |
+
"url" => $options['logo'],
|
112 |
+
"width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
|
113 |
+
"height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
|
114 |
+
);
|
115 |
+
}
|
116 |
$args = array_merge( $args, $publisher_args );
|
117 |
}
|
118 |
|
includes/meta/wp-structuring-meta-news-article.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Schema.org Type News Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
7 |
* @since 4.0.0
|
8 |
* @link http://schema.org/NewsArticle
|
9 |
* @link https://developers.google.com/search/docs/data-types/articles
|
@@ -32,7 +32,7 @@ class Structuring_Markup_Meta_NewsArticle {
|
|
32 |
/**
|
33 |
* Setting schema.org NewsArticle
|
34 |
*
|
35 |
-
* @version 4.
|
36 |
* @since 4.0.0
|
37 |
* @param array $options
|
38 |
* @return array $args
|
@@ -72,36 +72,47 @@ class Structuring_Markup_Meta_NewsArticle {
|
|
72 |
)
|
73 |
);
|
74 |
$args = array_merge( $args, $images_args );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
|
77 |
-
|
78 |
-
if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
|
79 |
$publisher_args = array(
|
80 |
"publisher" => array(
|
81 |
"@type" => "Organization",
|
82 |
-
"name" =>
|
83 |
-
"logo" => array(
|
84 |
-
"@type" => "ImageObject",
|
85 |
-
"url" => $options['logo'],
|
86 |
-
"width" => $logo['width'],
|
87 |
-
"height" => $logo['height']
|
88 |
-
)
|
89 |
-
)
|
90 |
-
);
|
91 |
-
$args = array_merge( $args, $publisher_args );
|
92 |
-
} else if ( !empty( $options['logo'] ) ) {
|
93 |
-
$publisher_args = array(
|
94 |
-
"publisher" => array(
|
95 |
-
"@type" => "Organization",
|
96 |
-
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
|
97 |
-
"logo" => array(
|
98 |
-
"@type" => "ImageObject",
|
99 |
-
"url" => $options['logo'],
|
100 |
-
"width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
|
101 |
-
"height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
|
102 |
-
)
|
103 |
)
|
104 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
$args = array_merge( $args, $publisher_args );
|
106 |
}
|
107 |
|
3 |
* Schema.org Type News Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 4.1.0
|
7 |
* @since 4.0.0
|
8 |
* @link http://schema.org/NewsArticle
|
9 |
* @link https://developers.google.com/search/docs/data-types/articles
|
32 |
/**
|
33 |
* Setting schema.org NewsArticle
|
34 |
*
|
35 |
+
* @version 4.1.0
|
36 |
* @since 4.0.0
|
37 |
* @param array $options
|
38 |
* @return array $args
|
72 |
)
|
73 |
);
|
74 |
$args = array_merge( $args, $images_args );
|
75 |
+
} elseif ( isset( $options['content_image'] ) && $options['content_image'] === 'on' ) {
|
76 |
+
if ( $images = $this->utility->get_content_image( $post->post_content ) ) {
|
77 |
+
if ( $size = $this->utility->get_image_dimensions( $images ) ) {
|
78 |
+
$images_args = array(
|
79 |
+
"image" => array(
|
80 |
+
"@type" => "ImageObject",
|
81 |
+
"url" => $images,
|
82 |
+
"width" => $size['width'],
|
83 |
+
"height" => $size['height']
|
84 |
+
)
|
85 |
+
);
|
86 |
+
$args = array_merge( $args, $images_args );
|
87 |
+
}
|
88 |
+
}
|
89 |
}
|
90 |
|
91 |
+
if ( isset( $options['name'] ) ) {
|
|
|
92 |
$publisher_args = array(
|
93 |
"publisher" => array(
|
94 |
"@type" => "Organization",
|
95 |
+
"name" => esc_html( $options['name'] ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
)
|
97 |
);
|
98 |
+
|
99 |
+
$options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
|
100 |
+
|
101 |
+
if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
|
102 |
+
$publisher_args['publisher']['logo'] = array(
|
103 |
+
"@type" => "ImageObject",
|
104 |
+
"url" => $options['logo'],
|
105 |
+
"width" => $logo['width'],
|
106 |
+
"height" => $logo['height']
|
107 |
+
);
|
108 |
+
} else if ( !empty( $options['logo'] ) ) {
|
109 |
+
$publisher_args['publisher']['logo'] = array(
|
110 |
+
"@type" => "ImageObject",
|
111 |
+
"url" => $options['logo'],
|
112 |
+
"width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
|
113 |
+
"height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
|
114 |
+
);
|
115 |
+
}
|
116 |
$args = array_merge( $args, $publisher_args );
|
117 |
}
|
118 |
|
includes/wp-structuring-utility.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Utility
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
7 |
* @since 4.0.0
|
8 |
*/
|
9 |
class Structuring_Markup_Utility {
|
@@ -42,4 +42,27 @@ class Structuring_Markup_Utility {
|
|
42 |
return __return_false();
|
43 |
}
|
44 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
3 |
* Utility
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 4.1.0
|
7 |
* @since 4.0.0
|
8 |
*/
|
9 |
class Structuring_Markup_Utility {
|
42 |
return __return_false();
|
43 |
}
|
44 |
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Return image dimensions
|
48 |
+
*
|
49 |
+
* @version 4.1.0
|
50 |
+
* @since 4.1.0
|
51 |
+
* @author Kazuya Takami
|
52 |
+
* @param string $content
|
53 |
+
* @return array | boolean $images
|
54 |
+
*/
|
55 |
+
public function get_content_image ( $content ) {
|
56 |
+
$pattern = '/<img.*?src=(["\'])(.+?)\1.*?>/i';
|
57 |
+
|
58 |
+
if ( preg_match( $pattern, $content, $images ) ){
|
59 |
+
if ( is_array( $images ) && isset( $images[2] ) ) {
|
60 |
+
return $images[2];
|
61 |
+
} else {
|
62 |
+
return __return_false();
|
63 |
+
}
|
64 |
+
} else {
|
65 |
+
return __return_false();
|
66 |
+
}
|
67 |
+
}
|
68 |
}
|
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.8.0
|
6 |
-
Stable tag: 4.0
|
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 |
= 4.0.2 (2017-06-14) =
|
58 |
* Checked : WordPress version 4.8.0 operation check.
|
59 |
* Updated : Warning: Event type schema.org ( availability, validFrom and performer. )
|
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.8.0
|
6 |
+
Stable tag: 4.1.0
|
7 |
|
8 |
Allows you to include schema.org JSON-LD syntax markup on your website
|
9 |
|
54 |
|
55 |
== Changelog ==
|
56 |
|
57 |
+
= 4.1.0 (2017-07-03) =
|
58 |
+
* Added : If there is no feature image setting, set the first image of the post.
|
59 |
+
* Updated : Oganization Image recommended.(Article / NewsArticle / BlogPosting)
|
60 |
+
* Fixed : Events and videos of custom posts should not appear in choices.
|
61 |
+
* Fixed : Organization type Notice Error.
|
62 |
+
|
63 |
= 4.0.2 (2017-06-14) =
|
64 |
* Checked : WordPress version 4.8.0 operation check.
|
65 |
* Updated : Warning: Event type schema.org ( availability, validFrom and performer. )
|
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: 4.0
|
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 4.0
|
22 |
* @since 1.0.0
|
23 |
*/
|
24 |
class Structuring_Markup {
|
@@ -26,10 +26,10 @@ class Structuring_Markup {
|
|
26 |
/**
|
27 |
* Variable definition version.
|
28 |
*
|
29 |
-
* @version 4.0
|
30 |
* @since 1.3.0
|
31 |
*/
|
32 |
-
private $version = '4.0
|
33 |
|
34 |
/**
|
35 |
* Variable definition Text Domain.
|
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: 4.1.0
|
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 4.1.0
|
22 |
* @since 1.0.0
|
23 |
*/
|
24 |
class Structuring_Markup {
|
26 |
/**
|
27 |
* Variable definition version.
|
28 |
*
|
29 |
+
* @version 4.1.0
|
30 |
* @since 1.3.0
|
31 |
*/
|
32 |
+
private $version = '4.1.0';
|
33 |
|
34 |
/**
|
35 |
* Variable definition Text Domain.
|