Version Description
-
Download this release
Release Info
Developer | looswebstudio |
Plugin | SEO SIMPLE PACK |
Version | 1.2.2 |
Comparing to | |
See all releases |
Code changes from version 1.2.1 to 1.2.2
- class/ssp_methods.php +12 -1
- class/ssp_output.php +28 -22
- readme.txt +6 -2
- seo-simple-pack.php +2 -2
class/ssp_methods.php
CHANGED
@@ -69,7 +69,7 @@ class SSP_Methods {
|
|
69 |
public static function set_branch() {
|
70 |
|
71 |
SSP_Branch::$is_ = [
|
72 |
-
'home' => is_home()
|
73 |
'front' => is_front_page(),
|
74 |
'single' => is_single(),
|
75 |
'page' => is_page(),
|
@@ -88,6 +88,17 @@ class SSP_Methods {
|
|
88 |
'search' => is_search(),
|
89 |
'404' => is_404(),
|
90 |
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
}
|
92 |
|
93 |
|
69 |
public static function set_branch() {
|
70 |
|
71 |
SSP_Branch::$is_ = [
|
72 |
+
'home' => is_home(),
|
73 |
'front' => is_front_page(),
|
74 |
'single' => is_single(),
|
75 |
'page' => is_page(),
|
88 |
'search' => is_search(),
|
89 |
'404' => is_404(),
|
90 |
];
|
91 |
+
if ( is_front_page() ) {
|
92 |
+
SSP_Branch::$is_['top'] = true;
|
93 |
+
} elseif ( is_home() ) {
|
94 |
+
if ( get_queried_object_id() === 0) {
|
95 |
+
SSP_Branch::$is_['top'] = true;
|
96 |
+
} else {
|
97 |
+
SSP_Branch::$is_['top'] = false;
|
98 |
+
}
|
99 |
+
} else {
|
100 |
+
SSP_Branch::$is_['top'] = false;
|
101 |
+
}
|
102 |
}
|
103 |
|
104 |
|
class/ssp_output.php
CHANGED
@@ -188,12 +188,13 @@ class SSP_Output {
|
|
188 |
private static function generate_title( $is_ ) {
|
189 |
|
190 |
switch ( true ) {
|
191 |
-
case $is_[ '
|
192 |
|
193 |
$title = SSP_Data::$settings[ 'home_title' ];
|
194 |
break;
|
195 |
|
196 |
case $is_[ 'singular' ] :
|
|
|
197 |
$meta_title = get_post_meta(self::$obj->ID, SSP_MetaBox::P_METANAME['title'], true);
|
198 |
if ( $meta_title ) {
|
199 |
$title = $meta_title;
|
@@ -253,6 +254,7 @@ class SSP_Output {
|
|
253 |
}
|
254 |
|
255 |
$title = self::replace_snippets( $title );
|
|
|
256 |
|
257 |
return apply_filters( 'ssp_output_title', $title );
|
258 |
}
|
@@ -267,12 +269,13 @@ class SSP_Output {
|
|
267 |
|
268 |
switch ( true ) {
|
269 |
|
270 |
-
case $is_[ '
|
271 |
|
272 |
$robots = "";
|
273 |
break;
|
274 |
|
275 |
case $is_[ 'singular' ] :
|
|
|
276 |
|
277 |
$meta_robots = get_post_meta(self::$obj->ID, SSP_MetaBox::P_METANAME['robots'], true);
|
278 |
if ( $meta_robots ) {
|
@@ -366,7 +369,7 @@ class SSP_Output {
|
|
366 |
|
367 |
$keyword = SSP_Data::$settings[ 'home_keyword' ];
|
368 |
|
369 |
-
if( $is_[ 'singular' ] ) {
|
370 |
|
371 |
//メタボックスが入力されていれば上書きする
|
372 |
$metabox_keyword = get_post_meta(self::$obj->ID, SSP_MetaBox::P_METANAME['keyword'], true);
|
@@ -391,12 +394,13 @@ class SSP_Output {
|
|
391 |
private static function generate_description( $is_ ) {
|
392 |
|
393 |
switch ( true ) {
|
394 |
-
case $is_[ '
|
395 |
|
396 |
$description = SSP_Data::$settings[ 'home_desc' ] ?: '%_phrase_%';
|
397 |
break;
|
398 |
|
399 |
case $is_[ 'singular' ] :
|
|
|
400 |
|
401 |
$metabox_desc = get_post_meta( self::$obj->ID, SSP_MetaBox::P_METANAME['description'], true );
|
402 |
|
@@ -484,13 +488,14 @@ class SSP_Output {
|
|
484 |
|
485 |
switch ( true ) {
|
486 |
|
487 |
-
case $is_[ '
|
488 |
|
489 |
$canonical = home_url();
|
490 |
break;
|
491 |
|
492 |
case $is_[ 'singular' ] :
|
493 |
|
|
|
494 |
$canonical = get_permalink();
|
495 |
break;
|
496 |
|
@@ -540,6 +545,7 @@ class SSP_Output {
|
|
540 |
|
541 |
$obj = self::$obj;
|
542 |
$canonical = get_permalink( $obj->ID );
|
|
|
543 |
break;
|
544 |
}
|
545 |
|
@@ -560,6 +566,7 @@ class SSP_Output {
|
|
560 |
return apply_filters( 'ssp_output_og_type', $og_type );
|
561 |
}
|
562 |
|
|
|
563 |
/**
|
564 |
* Generate the og:image for the current page.
|
565 |
* 投稿ページ:アイキャッチ画像を優先し、なければデフォルトのOG:Image画像
|
@@ -568,19 +575,20 @@ class SSP_Output {
|
|
568 |
* @return string : The og:image url.
|
569 |
*/
|
570 |
private static function generate_og_image() {
|
571 |
-
$
|
|
|
572 |
|
573 |
-
if
|
|
|
|
|
574 |
|
575 |
if ( has_post_thumbnail( self::$obj->ID ) ) {
|
576 |
$thumb_id = get_post_thumbnail_id( self::$obj->ID );
|
577 |
$thumb_url = wp_get_attachment_image_src( $thumb_id, 'full' );
|
578 |
-
$og_image
|
579 |
}
|
580 |
|
581 |
-
|
582 |
-
$og_image = self::$obj->guid;
|
583 |
-
}
|
584 |
}
|
585 |
return apply_filters( 'ssp_output_og_image', $og_image );
|
586 |
}
|
@@ -832,9 +840,6 @@ class SSP_Output {
|
|
832 |
}
|
833 |
|
834 |
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
/**
|
839 |
* Analytics and Webmaster code.
|
840 |
*
|
@@ -843,7 +848,7 @@ class SSP_Output {
|
|
843 |
private static function output_codes() {
|
844 |
|
845 |
//meta tags for webmaster tools
|
846 |
-
if( SSP_Branch::$is_['
|
847 |
$webmaster_codes = [
|
848 |
'webmaster_google' => 'google-site-verification',
|
849 |
'webmaster_bing' => 'msvalidate.01',
|
@@ -917,13 +922,14 @@ class SSP_Output {
|
|
917 |
private static function replace_snippets ( $str ) {
|
918 |
|
919 |
$obj = self::$obj;
|
|
|
920 |
$str = str_replace ( '%_site_title_%', SSP_Data::$site_title, $str );
|
921 |
$str = str_replace ( '%_phrase_%', SSP_Data::$site_catch_phrase, $str );
|
922 |
$str = str_replace ( '%_description_%', SSP_Data::$settings[ 'home_desc' ], $str );
|
923 |
|
924 |
-
if (
|
925 |
-
|
926 |
-
$title = get_the_title();
|
927 |
$str = str_replace ( '%_page_title_%', $title, $str );
|
928 |
|
929 |
if ( strpos( $str, '%_page_contents_%' ) !== false ) {
|
@@ -937,7 +943,7 @@ class SSP_Output {
|
|
937 |
|
938 |
}
|
939 |
|
940 |
-
} elseif (
|
941 |
//タームアーカイブ
|
942 |
$str = str_replace ( array('%_cat_name_%','%_tag_name_%','%_term_name_%'), $obj->name, $str );
|
943 |
$str = str_replace ('%_term_description_%', strip_shortcodes( $obj->description ), $str );
|
@@ -962,13 +968,13 @@ class SSP_Output {
|
|
962 |
if ( strpos( $str, '%_date_%' ) !== false ) {
|
963 |
|
964 |
$date = "";
|
965 |
-
if (
|
966 |
$date = get_query_var( 'year' )."年".get_query_var( 'monthnum' )."月".get_query_var( 'day' )."日";
|
967 |
}
|
968 |
-
elseif (
|
969 |
$date = get_query_var( 'year' )."年".get_query_var( 'monthnum' )."月";
|
970 |
}
|
971 |
-
elseif (
|
972 |
$date = get_query_var( 'year' )."年";
|
973 |
}
|
974 |
|
188 |
private static function generate_title( $is_ ) {
|
189 |
|
190 |
switch ( true ) {
|
191 |
+
case $is_[ 'top' ]:
|
192 |
|
193 |
$title = SSP_Data::$settings[ 'home_title' ];
|
194 |
break;
|
195 |
|
196 |
case $is_[ 'singular' ] :
|
197 |
+
case $is_[ 'home' ] :
|
198 |
$meta_title = get_post_meta(self::$obj->ID, SSP_MetaBox::P_METANAME['title'], true);
|
199 |
if ( $meta_title ) {
|
200 |
$title = $meta_title;
|
254 |
}
|
255 |
|
256 |
$title = self::replace_snippets( $title );
|
257 |
+
$title = trim( strip_shortcodes( strip_tags( $title ) ) );
|
258 |
|
259 |
return apply_filters( 'ssp_output_title', $title );
|
260 |
}
|
269 |
|
270 |
switch ( true ) {
|
271 |
|
272 |
+
case $is_[ 'top' ]:
|
273 |
|
274 |
$robots = "";
|
275 |
break;
|
276 |
|
277 |
case $is_[ 'singular' ] :
|
278 |
+
case $is_[ 'home' ] :
|
279 |
|
280 |
$meta_robots = get_post_meta(self::$obj->ID, SSP_MetaBox::P_METANAME['robots'], true);
|
281 |
if ( $meta_robots ) {
|
369 |
|
370 |
$keyword = SSP_Data::$settings[ 'home_keyword' ];
|
371 |
|
372 |
+
if ( $is_[ 'singular' ] || ( ! $is_[ 'top' ] && $is_[ 'home' ] ) ) {
|
373 |
|
374 |
//メタボックスが入力されていれば上書きする
|
375 |
$metabox_keyword = get_post_meta(self::$obj->ID, SSP_MetaBox::P_METANAME['keyword'], true);
|
394 |
private static function generate_description( $is_ ) {
|
395 |
|
396 |
switch ( true ) {
|
397 |
+
case $is_[ 'top' ]:
|
398 |
|
399 |
$description = SSP_Data::$settings[ 'home_desc' ] ?: '%_phrase_%';
|
400 |
break;
|
401 |
|
402 |
case $is_[ 'singular' ] :
|
403 |
+
case $is_[ 'home' ] :
|
404 |
|
405 |
$metabox_desc = get_post_meta( self::$obj->ID, SSP_MetaBox::P_METANAME['description'], true );
|
406 |
|
488 |
|
489 |
switch ( true ) {
|
490 |
|
491 |
+
case $is_[ 'top' ] :
|
492 |
|
493 |
$canonical = home_url();
|
494 |
break;
|
495 |
|
496 |
case $is_[ 'singular' ] :
|
497 |
|
498 |
+
//is_home は default
|
499 |
$canonical = get_permalink();
|
500 |
break;
|
501 |
|
545 |
|
546 |
$obj = self::$obj;
|
547 |
$canonical = get_permalink( $obj->ID );
|
548 |
+
|
549 |
break;
|
550 |
}
|
551 |
|
566 |
return apply_filters( 'ssp_output_og_type', $og_type );
|
567 |
}
|
568 |
|
569 |
+
|
570 |
/**
|
571 |
* Generate the og:image for the current page.
|
572 |
* 投稿ページ:アイキャッチ画像を優先し、なければデフォルトのOG:Image画像
|
575 |
* @return string : The og:image url.
|
576 |
*/
|
577 |
private static function generate_og_image() {
|
578 |
+
$is_ = SSP_Branch::$is_;
|
579 |
+
$og_image = SSP_Data::$ogp[ 'og_image' ];
|
580 |
|
581 |
+
if( $is_['attachment'] ) {
|
582 |
+
$og_image = self::$obj->guid;
|
583 |
+
} elseif ( $is_[ 'singular' ] || ( ! $is_[ 'top' ] && $is_[ 'home' ] ) ) {
|
584 |
|
585 |
if ( has_post_thumbnail( self::$obj->ID ) ) {
|
586 |
$thumb_id = get_post_thumbnail_id( self::$obj->ID );
|
587 |
$thumb_url = wp_get_attachment_image_src( $thumb_id, 'full' );
|
588 |
+
$og_image = $thumb_url[0];
|
589 |
}
|
590 |
|
591 |
+
|
|
|
|
|
592 |
}
|
593 |
return apply_filters( 'ssp_output_og_image', $og_image );
|
594 |
}
|
840 |
}
|
841 |
|
842 |
|
|
|
|
|
|
|
843 |
/**
|
844 |
* Analytics and Webmaster code.
|
845 |
*
|
848 |
private static function output_codes() {
|
849 |
|
850 |
//meta tags for webmaster tools
|
851 |
+
if ( SSP_Branch::$is_['top'] ) {
|
852 |
$webmaster_codes = [
|
853 |
'webmaster_google' => 'google-site-verification',
|
854 |
'webmaster_bing' => 'msvalidate.01',
|
922 |
private static function replace_snippets ( $str ) {
|
923 |
|
924 |
$obj = self::$obj;
|
925 |
+
$is_ = SSP_Branch::$is_;
|
926 |
$str = str_replace ( '%_site_title_%', SSP_Data::$site_title, $str );
|
927 |
$str = str_replace ( '%_phrase_%', SSP_Data::$site_catch_phrase, $str );
|
928 |
$str = str_replace ( '%_description_%', SSP_Data::$settings[ 'home_desc' ], $str );
|
929 |
|
930 |
+
if ( $is_['singular'] || ( ! $is_[ 'top' ] && $is_[ 'home' ] ) ) {
|
931 |
+
//タイトル
|
932 |
+
$title = get_the_title( $obj->ID );
|
933 |
$str = str_replace ( '%_page_title_%', $title, $str );
|
934 |
|
935 |
if ( strpos( $str, '%_page_contents_%' ) !== false ) {
|
943 |
|
944 |
}
|
945 |
|
946 |
+
} elseif ( $is_['category'] || $is_['tag'] || $is_['tax'] ) {
|
947 |
//タームアーカイブ
|
948 |
$str = str_replace ( array('%_cat_name_%','%_tag_name_%','%_term_name_%'), $obj->name, $str );
|
949 |
$str = str_replace ('%_term_description_%', strip_shortcodes( $obj->description ), $str );
|
968 |
if ( strpos( $str, '%_date_%' ) !== false ) {
|
969 |
|
970 |
$date = "";
|
971 |
+
if ( $is_['day'] ) {
|
972 |
$date = get_query_var( 'year' )."年".get_query_var( 'monthnum' )."月".get_query_var( 'day' )."日";
|
973 |
}
|
974 |
+
elseif ( $is_['month'] ) {
|
975 |
$date = get_query_var( 'year' )."年".get_query_var( 'monthnum' )."月";
|
976 |
}
|
977 |
+
elseif ( $is_['year'] ) {
|
978 |
$date = get_query_var( 'year' )."年";
|
979 |
}
|
980 |
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: looswebstudio
|
|
3 |
Donate link: https://loos-web-studio.com/
|
4 |
Tags: SEO,meta,analytics,webmaster,simple,japan
|
5 |
Requires at least: 4.6
|
6 |
-
Tested up to: 5.2.
|
7 |
-
Stable tag: 1.2.
|
8 |
Requires PHP: 5.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -108,6 +108,10 @@ wp_head内( `_wp_render_title_tag` )で出力される`title`タグは削除す
|
|
108 |
|
109 |
|
110 |
== Changelog ==
|
|
|
|
|
|
|
|
|
111 |
= 1.2.1 =
|
112 |
- カテゴリー・タグの各タームのアーカイブページごとに title / description / robots の設定ができるようになりました。
|
113 |
- スニペットタグ「%_term_description_%」を追加。
|
3 |
Donate link: https://loos-web-studio.com/
|
4 |
Tags: SEO,meta,analytics,webmaster,simple,japan
|
5 |
Requires at least: 4.6
|
6 |
+
Tested up to: 5.2.2
|
7 |
+
Stable tag: 1.2.2
|
8 |
Requires PHP: 5.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
108 |
|
109 |
|
110 |
== Changelog ==
|
111 |
+
|
112 |
+
= 1.2.2 =
|
113 |
+
- ホームページの表示設定で設定している「投稿ページ」にトップページと同じ内容のメタタグが出力されてしまう不具合を修正
|
114 |
+
|
115 |
= 1.2.1 =
|
116 |
- カテゴリー・タグの各タームのアーカイブページごとに title / description / robots の設定ができるようになりました。
|
117 |
- スニペットタグ「%_term_description_%」を追加。
|
seo-simple-pack.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: SEO SIMPLE PACK
|
4 |
Plugin URI: https://wemo.tech/1670
|
5 |
Description: シンプルなSEOプラグイン。ページ種別・投稿ごとにmetaタグやOGPタグを簡単に設定・カスタマイズできます。
|
6 |
-
Version: 1.2.
|
7 |
Author: LOOS WEB STUDIO
|
8 |
Author URI: https://loos-web-studio.com/
|
9 |
License: GPL2
|
@@ -56,7 +56,7 @@ if ( (double) $phpver < 5.6 ) {
|
|
56 |
* 定数宣言
|
57 |
*/
|
58 |
if ( ! defined( 'SSP_VERSION' ) ) {
|
59 |
-
define( 'SSP_VERSION', '1.2.
|
60 |
}
|
61 |
if ( ! defined( 'SSP_FILE' ) ) {
|
62 |
define( 'SSP_FILE', __FILE__ );
|
3 |
Plugin Name: SEO SIMPLE PACK
|
4 |
Plugin URI: https://wemo.tech/1670
|
5 |
Description: シンプルなSEOプラグイン。ページ種別・投稿ごとにmetaタグやOGPタグを簡単に設定・カスタマイズできます。
|
6 |
+
Version: 1.2.2
|
7 |
Author: LOOS WEB STUDIO
|
8 |
Author URI: https://loos-web-studio.com/
|
9 |
License: GPL2
|
56 |
* 定数宣言
|
57 |
*/
|
58 |
if ( ! defined( 'SSP_VERSION' ) ) {
|
59 |
+
define( 'SSP_VERSION', '1.2.2' );
|
60 |
}
|
61 |
if ( ! defined( 'SSP_FILE' ) ) {
|
62 |
define( 'SSP_FILE', __FILE__ );
|