diff --git a/class/mtee_canonical_setting.php b/class/mtee_canonical_setting.php index bedf5dc..3e02b14 100644 --- a/class/mtee_canonical_setting.php +++ b/class/mtee_canonical_setting.php @@ -57,9 +57,9 @@ if (!class_exists('mtee_canonical_setting')) { echo '
- +
'; } @@ -101,35 +101,47 @@ placeholder="' . $this->set_default_post_canonical_url($post->ID) . '" /> } public function add_tax_term_fields($tag) { - $form = '
Canonical URL
##CONTENTS##
'; - - echo $this->insert_term_meta_fields($tag, $form); + $canonical_url = $this->create_canonical_url($tag); + $placeholder = $this->create_placeholder($tag, $canonical_url); + echo '
Canonical URL
'; + echo ''; + echo '
'; } public function edit_tax_term_fields($tag) { - $form = ' - Canonical URL - ##CONTENTS## + $canonical_url = $this->create_canonical_url($tag); + $placeholder = $this->create_placeholder($tag, $canonical_url); + echo ' + Canonical URL + '; + echo ''; + echo ' '; - - echo $this->insert_term_meta_fields($tag, $form); } - public function insert_term_meta_fields($tag, $form) { + private function create_canonical_url($tag) { $canonical_url = ''; - $placeholder = ''; if (isset($tag->term_id)) { $canonical_url = get_term_meta($tag->term_id, MTEE_CONFIG::MTEE_CANONICAL_URL, true); } + return $canonical_url; + } + + private function create_placeholder($tag, $canonical_url) { + $placeholder = ''; if (isset($tag->term_id) && empty($canonical_url)) { $placeholder = $this->set_default_tax_canonical_url($tag->term_id, $tag->taxonomy); } - $add_meta = ''; - return str_replace('##CONTENTS##', $add_meta, $form); + return $placeholder; } - public function set_default_tax_canonical_url($id, $taxonomy) { + private function set_default_tax_canonical_url($id, $taxonomy) { if ($taxonomy == 'category') { $placeholder = get_category_link($id); } elseif ($taxonomy == 'post_tag') { diff --git a/class/mtee_meta_output_canonical.php b/class/mtee_meta_output_canonical.php index a529fbf..d68851d 100644 --- a/class/mtee_meta_output_canonical.php +++ b/class/mtee_meta_output_canonical.php @@ -38,7 +38,7 @@ if (!class_exists('mtee_meta_output_canonical')) { $type = 'posts'; } - echo $this->get_canonical_data($id, $type); + echo '' . PHP_EOL; } @@ -61,10 +61,7 @@ if (!class_exists('mtee_meta_output_canonical')) { } elseif ($type == 'tax') { $canonical = $this->set_tax_canonical($id); } - - if ($canonical) { - return '' . PHP_EOL; - } + return $canonical; } public function set_top_page_canonical() { diff --git a/class/mtee_meta_output_keydesc.php b/class/mtee_meta_output_keydesc.php index de54c09..c67bc61 100644 --- a/class/mtee_meta_output_keydesc.php +++ b/class/mtee_meta_output_keydesc.php @@ -24,7 +24,12 @@ if (!class_exists('mtee_meta_output_keydesc')) { public function post_output_add_metas() { $this->create_post_output_add_metas(); - echo implode(PHP_EOL, $this->metas) . PHP_EOL; + if (isset($this->metas[MTEE_CONFIG::MTEE_NAME_KEYWORDS])) { + echo ''; + } + if (isset($this->metas[MTEE_CONFIG::MTEE_NAME_DESCRIPTION])) { + echo ''; + } } public function create_post_output_add_metas() { @@ -42,25 +47,24 @@ if (!class_exists('mtee_meta_output_keydesc')) { $type = 'post_tag'; } if (isset($type)) { - $this->metas = $this->post_output_view_metas($type); + $this->post_output_view_metas($type); } if (count($this->metas) == 0) { - $this->metas = $this->create_default_keywords_description(); + $this->create_default_keywords_description(); } } - public function post_output_view_metas($type): array { + public function post_output_view_metas($type) { $targets = get_option('_mtee'); if (isset($targets['custom_posts']) && array_key_exists($type, $targets['custom_posts'])) { $type = 'custom_post'; } elseif (isset($targets['taxonomies']) && array_key_exists($type, $targets['taxonomies'])) { $type = 'custom_tax'; } - $meta_data = array( - MTEE_CONFIG::MTEE_NAME_KEYWORDS => esc_html(str_replace('、', ',', $this->post_output_get_meta_keywords($type))), - MTEE_CONFIG::MTEE_NAME_DESCRIPTION => esc_html($this->post_output_get_meta_desc($type)), + $this->metas = array( + MTEE_CONFIG::MTEE_NAME_KEYWORDS => str_replace('、', ',', $this->post_output_get_meta_keywords($type)), + MTEE_CONFIG::MTEE_NAME_DESCRIPTION => $this->post_output_get_meta_desc($type), ); - return $this->create_meta_tags($meta_data); } public function post_output_get_meta_keywords($type) { @@ -79,13 +83,12 @@ if (!class_exists('mtee_meta_output_keydesc')) { return $meta_key_words; } - public function create_default_keywords_description(): array { + public function create_default_keywords_description() { $this->description .= $this->create_default_description(); - $meta_data = array( - MTEE_CONFIG::MTEE_NAME_KEYWORDS => esc_html(implode(',', $this->create_default_keywords())), - MTEE_CONFIG::MTEE_NAME_DESCRIPTION => esc_html($this->description), + $this->metas = array( + MTEE_CONFIG::MTEE_NAME_KEYWORDS => implode(',', $this->create_default_keywords()), + MTEE_CONFIG::MTEE_NAME_DESCRIPTION => $this->description, ); - return $this->create_meta_tags($meta_data); } public function create_default_keywords(): array { @@ -207,10 +210,10 @@ if (!class_exists('mtee_meta_output_keydesc')) { public function create_meta_tags($meta_data): array { $metas = array(); if (!empty($meta_data[MTEE_CONFIG::MTEE_NAME_KEYWORDS])) { - $metas[] = str_replace('##KEYWORDS##', $meta_data[MTEE_CONFIG::MTEE_NAME_KEYWORDS], ''); + $metas[MTEE_CONFIG::MTEE_NAME_KEYWORDS] = str_replace('##KEYWORDS##', $meta_data[MTEE_CONFIG::MTEE_NAME_KEYWORDS], ''); } if (!empty($meta_data[MTEE_CONFIG::MTEE_NAME_DESCRIPTION])) { - $metas[] = str_replace('##DISCRIPTION##', $meta_data[MTEE_CONFIG::MTEE_NAME_DESCRIPTION], ''); + $metas[MTEE_CONFIG::MTEE_NAME_DESCRIPTION] = str_replace('##DISCRIPTION##', $meta_data[MTEE_CONFIG::MTEE_NAME_DESCRIPTION], ''); } return $metas; } diff --git a/class/mtee_meta_output_noindexnofollow.php b/class/mtee_meta_output_noindexnofollow.php index 8f9ea5f..8f73c60 100644 --- a/class/mtee_meta_output_noindexnofollow.php +++ b/class/mtee_meta_output_noindexnofollow.php @@ -41,7 +41,7 @@ if (!class_exists('mtee_meta_output_noindexnofollow')) { $type = 'posts'; } - echo $this->get_noindex_nofollow_data($id, $type); + $this->get_noindex_nofollow_data($id, $type); } @@ -56,13 +56,13 @@ if (!class_exists('mtee_meta_output_noindexnofollow')) { return; } if ($status['noindex'] == '1' && $status['nofollow'] == '1') { - return ''; + echo ''; } if ($status['noindex'] == '1' && $status['nofollow'] == '0') { - return ''; + echo ''; } if ($status['noindex'] == '0' && $status['nofollow'] == '1') { - return ''; + echo ''; } } diff --git a/class/mtee_meta_output_ogp.php b/class/mtee_meta_output_ogp.php index 8f83d84..7b5d0b1 100644 --- a/class/mtee_meta_output_ogp.php +++ b/class/mtee_meta_output_ogp.php @@ -44,23 +44,22 @@ if (!class_exists('mtee_meta_output_ogp')) { $this->create_ogp_description(); $this->create_ogp_image(); $this->create_ogp_url(); - echo $this->set_ogp_tag(); + $this->set_ogp_tag(); } public function set_ogp_tag() { - $tags = '' . PHP_EOL; - $tags .= '' . PHP_EOL; - $tags .= '' . PHP_EOL; - $tags .= '' . PHP_EOL; + echo '' . PHP_EOL; + echo '' . PHP_EOL; + echo '' . PHP_EOL; + echo '' . PHP_EOL; if (!empty($this->ogp_img)) { - $tags .= '' . PHP_EOL; + echo '' . PHP_EOL; } - $tags .= '' . PHP_EOL; + echo '' . PHP_EOL; // $tags .= '' . PHP_EOL; // $tags .= '' . PHP_EOL; - $tags .= '' . "\n"; - return $tags; + echo '' . PHP_EOL; } public function get_ogp_locale(): string { diff --git a/class/mtee_noindexnofolow_setting.php b/class/mtee_noindexnofolow_setting.php index 0ee3519..4573bf9 100644 --- a/class/mtee_noindexnofolow_setting.php +++ b/class/mtee_noindexnofolow_setting.php @@ -51,20 +51,18 @@ if (!class_exists('mtee_noindexnofolow_setting')) { $nofollow_value = get_post_meta($post->ID, MTEE_CONFIG::MTEE_NAME_NOFOLLOW, true); echo '
-
- - -
-
- - - +
+ + + +
+
+ + + +
-
'; +'; } // カスタムフィールドの値を保存 @@ -95,42 +93,50 @@ if (!class_exists('mtee_noindexnofolow_setting')) { } public function add_tax_term_fields($tag) { - $form = '
##CONTENTS##
'; - - echo $this->insert_term_meta_fields($tag, $form); + ?> +
+ insert_term_meta_fields($tag); + ?> +
+ - noindex / nofollow - ##CONTENTS## - '; + ?> + + noindex / nofollow - echo $this->insert_term_meta_fields($tag, $form); + + insert_term_meta_fields($tag); + ?> + + + term_id)) { $noindex_value = get_term_meta($tag->term_id, MTEE_CONFIG::MTEE_NAME_NOINDEX, true); $nofollow_value = get_term_meta($tag->term_id, MTEE_CONFIG::MTEE_NAME_NOFOLLOW, true); } - $add_meta = ' + echo '
- - -
'; - - return str_replace('##CONTENTS##', $add_meta, $form); + + + +'; } diff --git a/class/mtee_ogp_post_setting.php b/class/mtee_ogp_post_setting.php index 782e980..2ac0899 100644 --- a/class/mtee_ogp_post_setting.php +++ b/class/mtee_ogp_post_setting.php @@ -49,31 +49,31 @@ if (!class_exists('mtee_ogp_post_setting')) {
+name="' . esc_attr(MTEE_CONFIG::MTEE_OGP_TITLE) . '" +value="' . esc_attr(get_post_meta($post->ID, MTEE_CONFIG::MTEE_OGP_TITLE, true)) . '" +placeholder="' . esc_attr($this->set_default_ogp_title()) . '"/>
+name="' . esc_attr(MTEE_CONFIG::MTEE_OGP_DESC) . '" +value="' . esc_attr(get_post_meta($post->ID, MTEE_CONFIG::MTEE_OGP_DESC, true)) . '" +placeholder="' . esc_attr($this->set_default_ogp_desc()) . '"/>
- +
' . $this->set_ogp_thumb($post->ID) . '
'; } diff --git a/class/mtee_ogp_tax_setting.php b/class/mtee_ogp_tax_setting.php index 23d6718..08829fe 100644 --- a/class/mtee_ogp_tax_setting.php +++ b/class/mtee_ogp_tax_setting.php @@ -50,26 +50,26 @@ if (!class_exists('mtee_ogp_tax_setting')) { echo '
OGP title
-
OGP description
-
image
- +
'; @@ -82,23 +82,23 @@ var ogp_img_name = ' . "'" . esc_html(MTEE_CONFIG::MTEE_OGP_IMG) . "'" . ' OGP - - - +
' . $this->set_ogp_thumb($tag->term_id) . '
diff --git a/class/mtee_post_setting.php b/class/mtee_post_setting.php index 3a4454f..2a6ee1f 100644 --- a/class/mtee_post_setting.php +++ b/class/mtee_post_setting.php @@ -48,14 +48,14 @@ if (!class_exists('mtee_post_setting')) { global $post; echo '
-
+
'; echo ' -
+
'; } diff --git a/class/mtee_tax_setting.php b/class/mtee_tax_setting.php index 8e61391..4c90c9e 100644 --- a/class/mtee_tax_setting.php +++ b/class/mtee_tax_setting.php @@ -45,16 +45,16 @@ if (!class_exists('mtee_tax_setting')) { echo '
meta keywords
-
meta description
-
'; @@ -67,14 +67,14 @@ class="tax-meta-field" /> meta keywords
meta description - - diff --git a/template/index.php b/template/index.php index 5fc3e4b..4f35726 100644 --- a/template/index.php +++ b/template/index.php @@ -1,15 +1,6 @@ get_key_setting('enabled'); -//$noindex_nofollow = $this->get_key_setting('noindex_nofollow'); -//$ogp_setting = $this->get_key_setting('ogp_setting'); -//$canonical_setting = $this->get_key_setting('canonical_setting'); -//$wp_ver_disabled = $this->get_key_setting('wp_ver_disabled'); -//$asset_ver_disabled = $this->get_key_setting('asset_ver_disabled'); -//$emoji_disabled = $this->get_key_setting('emoji_disabled'); -//$rss_disabled = $this->get_key_setting('rss_disabled'); ?>

meta keyword, description / バージョン情報 設定

@@ -25,7 +16,7 @@ $opt = get_option('_mtee');
+ value="">

メタキーワード・ディスクリプション

@@ -40,33 +31,33 @@ $opt = get_option('_mtee');

個別設定していない投稿やカテゴリー等は、このテンプレートを適用します。

投稿
-
+
base[$param][$type]
ページ
カテゴリー
タグ
カスタム分類
@@ -94,31 +85,31 @@ $opt = get_option('_mtee');
ページ/投稿
カテゴリー
+ value="" + placeholder="##site_name##の##title##">
タグ
+ value="" + placeholder="##site_name##の##title##">
カスタム分類
+ value="" + placeholder="##site_name##の##title##">
    -
  • ##site_name##:サイト名(
  • -
  • ##site_description##:サイトの説明(
  • +
  • ##site_name##:サイト名(
  • +
  • ##site_description##:サイトの説明(
  • ##title##:投稿、ページ、カテゴリー等のタイトル
diff --git a/template/pages_canonical.php b/template/pages_canonical.php index ad03e54..fc80c9e 100644 --- a/template/pages_canonical.php +++ b/template/pages_canonical.php @@ -5,8 +5,8 @@ Canonical URL + value="" + placeholder=""> @@ -17,16 +17,16 @@

- label; ?> + label); ?> (

Canonical URL + name="_mtee[custom_post][][canonical]" + value="" + placeholder="">
diff --git a/template/pages_meta.php b/template/pages_meta.php index 1d2534b..68c04fe 100644 --- a/template/pages_meta.php +++ b/template/pages_meta.php @@ -24,15 +24,15 @@

- label; ?> + label); ?> (

@@ -40,9 +40,9 @@
meta keywords
キーワードはカンマ(,)区切りで入力してください
meta description + name="_mtee[custom_post][][description]" + value="" + placeholder="の[カスタム投稿ラベル]">
diff --git a/template/pages_noindexnofollow.php b/template/pages_noindexnofollow.php index c5c2b78..54b676f 100644 --- a/template/pages_noindexnofollow.php +++ b/template/pages_noindexnofollow.php @@ -38,7 +38,7 @@ $nofollow = $opt['top_page']['nofollow'] ?? '0';

- label; ?> + label); ?> (

@@ -48,10 +48,10 @@ $nofollow = $opt['top_page']['nofollow'] ?? '0';
diff --git a/template/pages_ogp.php b/template/pages_ogp.php index 117a1c4..9a6a64e 100644 --- a/template/pages_ogp.php +++ b/template/pages_ogp.php @@ -4,21 +4,21 @@
OGP title + value="">
OGP description + value="">
OGP Image - + value=""/>
get_ogp_img('top_page'); ?>
@@ -32,31 +32,31 @@

- label; ?> + label); ?> (

OGP title + name="_mtee[custom_post][][ogp_title]" + value="">
OGP description + name="_mtee[custom_post][][ogp_description]" + value="">
OGP Image - + value=""/>
get_ogp_img('custom_post', $custom_post); ?>
@@ -67,6 +67,6 @@