diff --git a/class/mtee-output.php b/class/mtee-output.php index 8bfba48..e1c4d32 100644 --- a/class/mtee-output.php +++ b/class/mtee-output.php @@ -32,6 +32,8 @@ if (!class_exists('mtee_meta_output')) { $metas = array(); if (is_home() || is_front_page()) { $metas = $this->post_output_view_metas('top_page'); + } elseif (is_post_type_archive()) { + $metas = $this->post_output_view_metas('custom_post_archive'); } elseif (is_tax()) { $metas = $this->post_output_view_metas(get_queried_object()->taxonomy); } elseif (is_page() || is_single()) { @@ -65,6 +67,10 @@ if (!class_exists('mtee_meta_output')) { if ($type == 'top_page') { $meta_key_words = get_option('_mtee')['top_page']['keywords']; $meta_description = get_option('_mtee')['top_page']['description']; + } elseif ($type == 'custom_post_archive') { + $custom_post_name = get_post_type_object(get_post_type())->name; + $meta_key_words = get_option('_mtee')['custom_post'][$custom_post_name]['keywords']; + $meta_description = get_option('_mtee')['custom_post'][$custom_post_name]['description']; } elseif ($type == 'custom_tax' || $type == 'category' || $type == 'post_tag') { $queried_object = get_queried_object(); $meta_key_words = get_term_meta($queried_object->term_id, MTEE_NAME_KEYWORDS, true); @@ -148,7 +154,10 @@ if (!class_exists('mtee_meta_output')) { public function set_noindex_nofollow() { global $post; $type = ''; - if (is_category()) { + $id = null; + if (is_post_type_archive()) { + $type = 'custom_post_archive'; + } elseif (is_category()) { $id = get_query_var('cat'); $type = 'tax'; } elseif (is_tag()) { @@ -158,7 +167,6 @@ if (!class_exists('mtee_meta_output')) { $id = get_queried_object()->term_id; $type = 'tax'; } elseif (is_home() || is_front_page()) { - $id = null; $type = 'top_page'; } elseif (is_page() || is_single()) { $id = $post->ID; @@ -196,6 +204,10 @@ if (!class_exists('mtee_meta_output')) { if ($type == 'top_page') { $noindex = get_option('_mtee')['top_page']['noindex']; $nofollow = get_option('_mtee')['top_page']['nofollow']; + } elseif ($type == 'custom_post_archive') { + $custom_post_name = get_post_type_object(get_post_type())->name; + $noindex = get_option('_mtee')['custom_post'][$custom_post_name]['noindex']; + $nofollow = get_option('_mtee')['custom_post'][$custom_post_name]['nofollow']; } elseif ($type == 'posts') { $noindex = get_post_meta($id, MTEE_NAME_NOINDEX, true); $nofollow = get_post_meta($id, MTEE_NAME_NOFOLLOW, true); diff --git a/template/pages.php b/template/pages.php index b5f6e3a..6062105 100644 --- a/template/pages.php +++ b/template/pages.php @@ -1,4 +1,5 @@ register_target(); $opt = get_option('_mtee'); $keywords = $opt['top_page']['keywords'] ?? ''; $description = $opt['top_page']['description'] ?? ''; @@ -9,49 +10,110 @@ $nofollow = $opt['top_page']['nofollow'] ?? '0';

meta keyword, description / ページ設定

is_enable()): ?>
- - -
-

トップページ

- - - - - - - - - - - - - -
meta keywords -
キーワードはカンマ(,)区切りで入力してください -
meta description -
noindex nofollow -
- - -
-
-
-

-
+ + +

トップページ

+
+ + + + + + + + + + + + + +
meta keywords +
キーワードはカンマ(,)区切りで入力してください +
meta description +
noindex nofollow +
+ + +
+
+
+

+ 0): ?> +

カスタム投稿アーカイブ

+ + + +
+

+ label; ?> + () +

+ + + + + + + + + + + + + +
meta keywords +
キーワードはカンマ(,)区切りで入力してください +
meta description +
noindex nofollow +
+ + +
+
+
+

+ + +

全体設定を有効にしてください