WP PLUGIN MTEE(Meta Tag etc Extend) ディスクリプションのテンプレート設定追加

・投稿、カテゴリー、タグ、カスタム分類にmeta descriptionを設定していない場合のデフォルト表示テンプレート設定の追加
This commit is contained in:
2021-05-24 18:53:54 +09:00
parent d31a17275a
commit db7712f9ba
8 changed files with 429 additions and 281 deletions
+43 -14
View File
@@ -31,22 +31,24 @@ if (!class_exists('mtee_meta_output')) {
public function post_output_add_metas() {
$metas = array();
if (is_home() || is_front_page()) {
$metas = $this->post_output_view_metas('top_page');
$type = 'top_page';
} elseif (is_post_type_archive()) {
$metas = $this->post_output_view_metas('custom_post_archive');
$type = 'custom_post_archive';
} elseif (is_tax()) {
$metas = $this->post_output_view_metas(get_queried_object()->taxonomy);
$type = get_queried_object()->taxonomy;
} elseif (is_page() || is_single()) {
$metas = $this->post_output_view_metas(get_post_type());
$type = get_post_type();
} elseif (is_category()) {
$metas = $this->post_output_view_metas('category');
$type = 'category';
} elseif (is_tag()) {
$metas = $this->post_output_view_metas('post_tag');
$type = 'post_tag';
}
if (isset($type)) {
$metas = $this->post_output_view_metas($type);
}
if (count($metas) == 0) {
$metas = $this->create_default_keywords_description();
}
echo implode(PHP_EOL, $metas) . PHP_EOL;
}
@@ -81,7 +83,7 @@ if (!class_exists('mtee_meta_output')) {
}
return array(
MTEE_NAME_KEYWORDS => $meta_key_words,
MTEE_NAME_KEYWORDS => str_replace('、', ',', $meta_key_words),
MTEE_NAME_DESCRIPTION => $meta_description,
);
}
@@ -127,27 +129,54 @@ if (!class_exists('mtee_meta_output')) {
}
private function createDescription() {
$type = '';
$title = '';
$suffix_text = MTEE_META_DESC_ARCHIVE_BASE;
if (is_home() || is_front_page()) { //ページ
$this->description .= MTEE_META_DESC_TOP_BASE;
} elseif (is_page() || is_single()) { //ページ
$replacement = array(get_the_title(), MTEE_META_DESC_SINGLE_BASE);
$type = 'page';
$title = get_the_title();
$suffix_text = MTEE_META_DESC_SINGLE_BASE;
} elseif (is_category()) { //カテゴリー
$replacement = array(single_cat_title('', false), MTEE_META_DESC_ARCHIVE_BASE);
$type = 'category';
$title = single_cat_title('', false);
} elseif (is_tag()) { //タグ
$replacement = array(single_tag_title('', false), MTEE_META_DESC_ARCHIVE_BASE);
$type = 'tag';
$title = single_tag_title('', false);
} elseif (is_tax()) { //タクソノミー
$replacement = array(single_term_title('', false), MTEE_META_DESC_ARCHIVE_BASE);
$type = 'tax';
$title = single_term_title('', false);
} elseif (is_post_type_archive()) { //カスタム投稿のアーカイブ
$replacement = array(post_type_archive_title('', false), MTEE_META_DESC_ARCHIVE_BASE);
$type = 'custom_post';
$title = post_type_archive_title('', false);
}
if (isset($replacement)) {
$replacement = $this->cnv_custom_template($type, $title, $suffix_text);
if (isset($replacement['org'])) {
$search = array('<###>', '<%%%>');
$description_noun = MTEE_META_DESC_BEFORE_BRACKETS . '<###>' . MTEE_META_DESC_AFTER_BRACKETS . '<%%%>';
$this->description .= str_replace($search, $replacement, $description_noun);
}
}
private function cnv_custom_template($type, $title, $suffix_text) {
if ($type == 'custom_post') {
return array('org' => array(post_type_archive_title('', false), $suffix_text));
}
$template = get_option('_mtee')['description_tmp'];
if (isset($template[$type]) && !empty($template[$type])) {
$search = array('##title##', '##site_name##');
$replacement = array($title, get_bloginfo('name'));
$this->description = str_replace($search, $replacement, $template[$type]);
} else {
return array('org' => array($title, $suffix_text));
}
}
//--------------------------------------------------------------------
// noindex, nofollow
//--------------------------------------------------------------------
-17
View File
@@ -26,23 +26,6 @@ if (!class_exists('MTEE')) {
array($this, 'show_option_page'),
''
);
add_submenu_page(
'mtee', // parent_slug
'Settings', // page_title
'全体設定', // menu_title
'administrator', // capability
'mtee', // menu_slug
array($this, 'show_option_page') // function
);
add_submenu_page(
'mtee', // parent_slug
'Pages setting', // page_title
'ページ設定', // menu_title
'administrator', // capability
'page_setting', // menu_slug
array($this, 'pages_setting') // function
);
}
public function show_option_page() {
+10 -10
View File
@@ -1,15 +1,15 @@
<?php
const MTEE_CLASS_DIR = __DIR__ . '/class/';
const MTEE_TEMPLATE_DIR = __DIR__ . '/template/';
const MTEE_NAME_KEYWORDS = 'mtee_meta_keywords';
const MTEE_CLASS_DIR = __DIR__ . '/class/';
const MTEE_TEMPLATE_DIR = __DIR__ . '/template/';
const MTEE_NAME_KEYWORDS = 'mtee_meta_keywords';
const MTEE_NAME_DESCRIPTION = 'mtee_meta_description';
const MTEE_NAME_NOINDEX = '_mtee_robots_noindex';
const MTEE_NAME_NOFOLLOW = '_mtee_robots_nofollow';
const MTEE_NAME_NOINDEX = '_mtee_robots_noindex';
const MTEE_NAME_NOFOLLOW = '_mtee_robots_nofollow';
const MTEE_META_DESC_TOP_BASE = 'トップページです';
const MTEE_META_DESC_SINGLE_BASE = 'ページです。';
const MTEE_META_DESC_ARCHIVE_BASE = '一覧ページです。';
const MTEE_META_DESC_PARTICLE = 'の';
const MTEE_META_DESC_TOP_BASE = 'トップページです';
const MTEE_META_DESC_SINGLE_BASE = 'ページです。';
const MTEE_META_DESC_ARCHIVE_BASE = '一覧ページです。';
const MTEE_META_DESC_PARTICLE = 'の';
const MTEE_META_DESC_BEFORE_BRACKETS = '「';
const MTEE_META_DESC_AFTER_BRACKETS = '」';
const MTEE_META_DESC_AFTER_BRACKETS = '」';
+88 -1
View File
@@ -4,6 +4,47 @@ h2 {
margin-bottom: 1em
}
.mtee_tab_menu ul {
display: flex;
margin: 0 0 -1px;
padding: 0;
}
.mtee_tab_menu li {
padding: .5em 1em;
background: #f9f9f9;
border: 1px solid #ccc;
margin-right: .5em;
margin-bottom: 0;
cursor: pointer;
}
.mtee_tab_menu li.en {
background: #fff;
border-bottom: 2px solid #fff;
}
.mtee_tab_menu li:last-child {
margin-right: 0;
}
.mtee_tab_box {
display: none;
margin-top: 0;
padding: 1em;
background: #fff;
border: 1px solid #ccc;
}
.mtee_tab_box:first-of-type {
display: block;
}
.mtee_box_border {
border-top: 1px solid #ccc;
}
.mtee-form-box {
margin-bottom: 2em;
}
@@ -24,8 +65,9 @@ h2 {
.mtee-example {
width: 95%;
margin-bottom: 2em;
padding: 1em;
background: #fff;
background: #f9f9f9;
border: 1px solid #666;
border-radius: 6px;
}
@@ -46,4 +88,49 @@ h2 {
.top_page_keywords,
.top_page_description {
width: 95%;
}
.mtee_page_title,
.mtee_page_archive_title {
padding-top: 1em;
}
.mtee_page_archive_title::before {
content: "■";
}
.mtee_description_tmp_list {
display: flex;
flex-wrap: wrap;
}
.mtee_description_tmp_list dt {
width: 20%;
margin-left: 0;
}
.mtee_description_tmp_list dd {
width: 77%;
margin-left: 0;
}
.mtee_description_tmp {
width: 100%;
}
::placeholder {
color: #999;
font-style: italic;
}
@media screen and (max-width: 768px) {
.mtee_description_tmp_list {
display: block;
}
.mtee_description_tmp_list dt,
.mtee_description_tmp_list dd {
width: 100%;
}
}
+20
View File
@@ -0,0 +1,20 @@
jQuery(function ($) {
nab_menu();
function nab_menu() {
let menu_list = $('.mtee_tab_menu li');
let content_box = $('.mtee_tab_box');
menu_list.on('click', function () {
if (!$(this).hasClass('en')) {
let index = $(this).index();
$('.mtee_tab_menu li').removeClass('en');
$(this).addClass('en');
content_box.hide();
$('.mtee_tab_box:eq(' + index + ')').show();
}
});
}
});
+20 -20
View File
@@ -8,8 +8,7 @@ Version: 1.0
/*
Todo:meta keywords & description
デスクリプションの雛形登録
・カスタム投稿アーカイブページ追加
キーワードの雛形設定
Todo:OGPタグ
・OGPタグを追加する
@@ -26,30 +25,31 @@ include_once MTEE_CLASS_DIR . 'mtee.php';
/**
* CSSを設定
*/
add_action( 'admin_enqueue_scripts', function () {
$plugin_url = plugin_dir_url( __FILE__ );
wp_enqueue_style( 'mtee_style', $plugin_url . 'css/mtee.css' );
} );
add_action('admin_enqueue_scripts', function () {
$plugin_url = plugin_dir_url(__FILE__);
wp_enqueue_style('mtee_style', $plugin_url . 'css/mtee.css');
wp_enqueue_script('mtee_js', $plugin_url . 'js/mtee.js', 'jquery');
});
$mtee = new MTEE;
$mtee = new MTEE;
$options = $mtee->get_options();
// 設定が有効の場合は、各フォームや出力用のクラスを有効にする
if ( $mtee->is_enable() ) {
require_once MTEE_CLASS_DIR . 'mtee-tax-setting.php';
require_once MTEE_CLASS_DIR . 'mtee-post-setting.php';
require_once MTEE_CLASS_DIR . 'mtee-output.php';
new mtee_tax_setting( $options );
new mtee_post_setting( $options );
new mtee_meta_output;
if ($mtee->is_enable()) {
require_once MTEE_CLASS_DIR . 'mtee-tax-setting.php';
require_once MTEE_CLASS_DIR . 'mtee-post-setting.php';
require_once MTEE_CLASS_DIR . 'mtee-output.php';
new mtee_tax_setting($options);
new mtee_post_setting($options);
new mtee_meta_output;
}
if ( $mtee->is_noindex_nofollow_disable() ) {
require_once MTEE_CLASS_DIR . 'mtee-noindexnofollow-setting.php';
new mtee_noindexnofolow_setting( $options );
if ($mtee->is_noindex_nofollow_disable()) {
require_once MTEE_CLASS_DIR . 'mtee-noindexnofollow-setting.php';
new mtee_noindexnofolow_setting($options);
}
if ( $mtee->is_wp_ver_disable() || $mtee->is_asset_ver_disable() ) {
require_once MTEE_CLASS_DIR . 'mtee-version-setting.php';
new mtee_version_setting( $options );
if ($mtee->is_wp_ver_disable() || $mtee->is_asset_ver_disable()) {
require_once MTEE_CLASS_DIR . 'mtee-version-setting.php';
new mtee_version_setting($options);
}
+248 -98
View File
@@ -8,115 +8,265 @@ $noindex_nofollow = $this->get_noindex_nofollow();
?>
<div class="wrap">
<h2>meta keyword, description / バージョン情報 設定</h2>
<nav class="mtee_tab_menu">
<ul>
<li class="en">全体設定</li>
<li>ページ設定</li>
</ul>
</nav>
<form action="" method="post">
<?php wp_nonce_field('check_options'); ?>
<div class="mtee-form-box">
<h3>キーワード・ディスクリプション</h3>
<label>
<input type="hidden" name="_mtee[enabled]" value="0">
<input type="checkbox" name="_mtee[enabled]" <?php checked($enabled, 1); ?>
value="1">有効
</label>
<div class="mtee_tab_box">
<div class="mtee-form-box">
<h2>キーワード・ディスクリプション</h2>
<label>
<input type="hidden" name="_mtee[enabled]" value="0">
<input type="checkbox" name="_mtee[enabled]" <?php checked($enabled, 1); ?>
value="1">有効
</label>
</div>
<?php if (count($register_targets['custom_posts']) > 0 || count($register_targets['taxonomies']) > 0): ?>
<table class="mtee-setting-tbl">
<?php if (count($register_targets['custom_posts']) > 0): ?>
<tr>
<th>カスタム投稿</th>
<td>
<ul>
<?php foreach ($register_targets['custom_posts'] as $custom_post) : ?>
<?php $custom_post_check = $opt['custom_posts'][$custom_post] ?? 0; ?>
<li>
<label>
<input type="hidden"
name="_mtee[custom_posts][<?php echo $custom_post; ?>]"
value="0">
<input type="checkbox"
name="_mtee[custom_posts][<?php echo $custom_post; ?>]"
<?php checked($custom_post_check, 1); ?>
value="1">
<?php echo $custom_post . '' . get_post_type_object($custom_post)->label . ''; ?>
</label>
</li>
<?php endforeach; ?>
</ul>
</td>
</tr>
<?php endif; ?>
<?php if (count($register_targets['taxonomies']) > 0): ?>
<tr>
<th>カスタム分類</th>
<td>
<ul>
<?php foreach ($register_targets['taxonomies'] as $taxonomy) : ?>
<li>
<?php $taxonomy_check = $opt['taxonomies'][$taxonomy] ?? 0; ?>
<label>
<input type="hidden"
name="_mtee[taxonomies][<?php echo $taxonomy; ?>]" value="0">
<input type="checkbox"
name="_mtee[taxonomies][<?php echo $taxonomy; ?>]"
<?php checked($taxonomy_check, 1); ?>
value="1">
<?php echo $taxonomy . '' . get_taxonomy($taxonomy)->label . ''; ?>
</label>
</li>
<?php endforeach; ?>
</ul>
</td>
</tr>
<?php endif; ?>
</table>
<?php endif; ?>
<aside class="mtee-example">
<h4>keywordsの初期表示</h4>
<ul>
<li>[各ページ、カテゴリー、タグ等のタイトル],<?php
if (!empty(get_bloginfo('description'))) {
echo get_bloginfo('description') . ',';
}
echo get_bloginfo('name');
?>
</li>
</ul>
</aside>
<div class="mtee-form-box mtee_box_border">
<h3>meta description テンプレート設定</h3>
<p>個別設定していない投稿やカテゴリー等は、このテンプレートを適用します。</p>
<?php
$page_meta_desc_tmp = get_option('_mtee')['description_tmp']['page'] ?? '';
$cat_meta_desc_tmp = get_option('_mtee')['description_tmp']['category'] ?? '';
$tag_meta_desc_tmp = get_option('_mtee')['description_tmp']['tag'] ?? '';
$tax_meta_desc_tmp = get_option('_mtee')['description_tmp']['tax'] ?? '';
?>
<dl class="mtee_description_tmp_list">
<dt>ページ/投稿</dt>
<dd>
<input class="mtee_description_tmp" type="text" name="_mtee[description_tmp][page]"
value="<?php echo $page_meta_desc_tmp; ?>"
placeholder="##site_name##の<?php echo MTEE_META_DESC_BEFORE_BRACKETS; ?>##title##<?php echo MTEE_META_DESC_AFTER_BRACKETS; ?><?php echo MTEE_META_DESC_SINGLE_BASE; ?>"
</dd>
<dt>カテゴリー</dt>
<dd>
<input class="mtee_description_tmp" type="text" name="_mtee[description_tmp][category]"
value="<?php echo $cat_meta_desc_tmp; ?>"
placeholder="##site_name##の<?php echo MTEE_META_DESC_BEFORE_BRACKETS; ?>##title##<?php echo MTEE_META_DESC_AFTER_BRACKETS; ?><?php echo MTEE_META_DESC_ARCHIVE_BASE; ?>">
</dd>
<dt>タグ</dt>
<dd>
<input class="mtee_description_tmp" type="text" name="_mtee[description_tmp][tag]"
value="<?php echo $tag_meta_desc_tmp; ?>"
placeholder="##site_name##の<?php echo MTEE_META_DESC_BEFORE_BRACKETS; ?>##title##<?php echo MTEE_META_DESC_AFTER_BRACKETS; ?><?php echo MTEE_META_DESC_ARCHIVE_BASE; ?>">
</dd>
<dt>カスタム分類</dt>
<dd>
<input class="mtee_description_tmp" type="text" name="_mtee[description_tmp][tax]"
value="<?php echo $tax_meta_desc_tmp; ?>"
placeholder="##site_name##の<?php echo MTEE_META_DESC_BEFORE_BRACKETS; ?>##title##<?php echo MTEE_META_DESC_AFTER_BRACKETS; ?><?php echo MTEE_META_DESC_ARCHIVE_BASE; ?>">
</dd>
</dl>
<ul>
<li>##site_name##:サイト名(<?php echo get_bloginfo('name'); ?></li>
<li>##title##:出力対象(投稿、ページ、カテゴリー等)毎のタイトル</li>
</ul>
</div>
<div class="mtee-form-box mtee_box_border">
<h3>個別設定 NOINDEXNOFOLLOW</h3>
<label>
<input type="hidden" name="_mtee[noindex_nofollow]" value="0">
<input type="checkbox"
name="_mtee[noindex_nofollow]" <?php checked($noindex_nofollow, 1); ?>
value="1">有効
</label>
</div>
<div class="mtee-form-box mtee_box_border">
<h3>WordPressバージョン情報</h3>
<label>
<input type="hidden" name="_mtee[wp_ver_disabled]" value="0">
<input type="checkbox"
name="_mtee[wp_ver_disabled]" <?php checked($wp_ver_disabled, 1); ?>
value="1">削除
</label>
</div>
<div class="mtee-form-box mtee_box_border">
<h3>CSS / JSバージョン情報</h3>
<label>
<input type="hidden" name="_mtee[asset_ver_disabled]" value="0">
<input type="checkbox"
name="_mtee[asset_ver_disabled]" <?php checked($asset_ver_disabled, 1); ?>
value="1">削除
</label>
</div>
<p class="submit"><input type="submit" name="Submit" class="button-primary" value="変更を保存"/></p>
</div>
<?php if (count($register_targets['custom_posts']) > 0 || count($register_targets['taxonomies']) > 0): ?>
<table class="mtee-setting-tbl">
<?php if (count($register_targets['custom_posts']) > 0): ?>
<tr>
<th>カスタム投稿</th>
<td>
<ul>
<?php foreach ($register_targets['custom_posts'] as $custom_post) : ?>
<?php $custom_post_check = $opt['custom_posts'][$custom_post] ?? 0; ?>
<li>
<label>
<input type="hidden" name="_mtee[custom_posts][<?php echo $custom_post; ?>]"
value="0">
<input type="checkbox"
name="_mtee[custom_posts][<?php echo $custom_post; ?>]"
<?php checked($custom_post_check, 1); ?>
value="1">
<?php echo $custom_post . '' . get_post_type_object($custom_post)->label . ''; ?>
</label>
</li>
<?php endforeach; ?>
</ul>
<div class="mtee_tab_box">
<h2 class="mtee_page_title">トップページ</h2>
<?php
$keywords = $opt['top_page']['keywords'] ?? '';
$description = $opt['top_page']['description'] ?? '';
$noindex = $opt['top_page']['noindex'] ?? '0';
$nofollow = $opt['top_page']['nofollow'] ?? '0';
?>
<div class="mtee-form-box">
<table class="form-table">
<tr valign="top">
<th>meta keywords</th>
<td><input class="top_page_keywords" type="text" name="_mtee[top_page][keywords]"
value="<?php echo $keywords; ?>" placeholder="キーワード1,キーワード2,キーワード3">
<br>キーワードはカンマ(,)区切りで入力してください
</td>
</tr>
<?php endif; ?>
<?php if (count($register_targets['taxonomies']) > 0): ?>
<tr>
<th>カスタム分類</th>
<tr valign="top">
<th>meta description</th>
<td><input class="top_page_description" type="text" name="_mtee[top_page][description]"
value="<?php echo $description; ?>"
placeholder="<?php echo get_bloginfo('name'); ?>の<?php echo MTEE_META_DESC_TOP_BASE; ?>">
</td>
</tr>
<tr valign="top">
<th>noindex nofollow</th>
<td>
<ul>
<?php foreach ($register_targets['taxonomies'] as $taxonomy) : ?>
<li>
<?php $taxonomy_check = $opt['taxonomies'][$taxonomy] ?? 0; ?>
<div class="meta_noindex_nofollow_box">
<label>
<input type="hidden" name="_mtee[top_page][noindex]" value="0"/>
<input type="checkbox"
name="_mtee[top_page][noindex]" <?php checked($noindex, 1); ?>
value="1"/>
noindex
</label>
<label>
<input type="hidden" name="_mtee[top_page][nofollow]" value="0"/>
<input type="checkbox"
name="_mtee[top_page][nofollow]" <?php checked($nofollow, 1); ?>
value="1"/>
nofollow
</label>
</div>
</td>
</tr>
</table>
</div>
<?php if (count($register_targets['custom_posts']) > 0): ?>
<h2 class="mtee_page_title">カスタム投稿アーカイブ</h2>
<?php foreach ($register_targets['custom_posts'] as $custom_post): ?>
<?php
$keywords = $opt['custom_post'][$custom_post]['keywords'] ?? '';
$description = $opt['custom_post'][$custom_post]['description'] ?? '';
$noindex = $opt['custom_post'][$custom_post]['noindex'] ?? '0';
$nofollow = $opt['custom_post'][$custom_post]['nofollow'] ?? '0';
?>
<?php wp_nonce_field('check_options'); ?>
<div class="mtee-form-box">
<h3 class="mtee_page_archive_title">
<?php echo get_post_type_object($custom_post)->label; ?>
<?php echo $custom_post; ?>
</h3>
<table class="form-table">
<tr valign="top">
<th>meta keywords</th>
<td><input class="top_page_keywords" type="text"
name="_mtee[custom_post][<?php echo $custom_post; ?>][keywords]"
value="<?php echo $keywords; ?>" placeholder="キーワード1,キーワード2,キーワード3">
<br>キーワードはカンマ(,)区切りで入力してください
</td>
</tr>
<tr valign="top">
<th>meta description</th>
<td><input class="top_page_description" type="text"
name="_mtee[custom_post][<?php echo $custom_post; ?>][description]"
value="<?php echo $description; ?>"
placeholder="<?php echo get_bloginfo('name'); ?>の[カスタム投稿ラベル]<?php echo MTEE_META_DESC_ARCHIVE_BASE; ?>">
</td>
</tr>
<tr valign="top">
<th>noindex nofollow</th>
<td>
<div class="meta_noindex_nofollow_box">
<label>
<input type="hidden"
name="_mtee[taxonomies][<?php echo $taxonomy; ?>]" value="0">
name="_mtee[custom_post][<?php echo $custom_post; ?>][noindex]"
value="0"/>
<input type="checkbox"
name="_mtee[taxonomies][<?php echo $taxonomy; ?>]"
<?php checked($taxonomy_check, 1); ?>
value="1">
<?php echo $taxonomy . '' . get_taxonomy($taxonomy)->label . ''; ?>
name="_mtee[custom_post][<?php echo $custom_post; ?>][noindex]" <?php checked($noindex, 1); ?>
value="1"/>
noindex
</label>
</li>
<?php endforeach; ?>
</ul>
</td>
</tr>
<?php endif; ?>
</table>
<?php endif; ?>
<aside class="mtee-example">
<h4>keywordsの初期表示</h4>
<ul>
<li>[各ページ、カテゴリー、タグ等のタイトル],<?php
if (!empty(get_bloginfo('description'))) {
echo get_bloginfo('description') . ',';
}
echo get_bloginfo('name');
?>
</li>
</ul>
<h4>descriptionの初期表示</h4>
<ul>
<li>トップページ:<?php echo get_bloginfo('name'); ?>
の<?php echo MTEE_META_DESC_TOP_BASE; ?></li>
<li>ページ/投稿:<?php echo get_bloginfo('name'); ?>
の[ページタイトル]<?php echo MTEE_META_DESC_SINGLE_BASE; ?></li>
<li>カテゴリー/タグ等アーカイブ:<?php echo get_bloginfo('name'); ?>
の[カテゴリー/タグ等タイトル]<?php echo MTEE_META_DESC_SINGLE_BASE; ?></li>
</ul>
</aside>
<div class="mtee-form-box">
<h3>個別設定 NOINDEXNOFOLLOW</h3>
<label>
<input type="hidden" name="_mtee[noindex_nofollow]" value="0">
<input type="checkbox"
name="_mtee[noindex_nofollow]" <?php checked($noindex_nofollow, 1); ?>
value="1">有効
</label>
<label>
<input type="hidden"
name="_mtee[custom_post][<?php echo $custom_post; ?>][nofollow]"
value="0"/>
<input type="checkbox"
name="_mtee[custom_post][<?php echo $custom_post; ?>][nofollow]" <?php checked($nofollow, 1); ?>
value="1"/>
nofollow
</label>
</div>
</td>
</tr>
</table>
</div>
<?php endforeach; ?>
<?php endif; ?>
<p class="submit"><input type="submit" name="Submit" class="button-primary" value="変更を保存"/></p>
</div>
<div class="mtee-form-box">
<h3>WordPressバージョン情報</h3>
<label>
<input type="hidden" name="_mtee[wp_ver_disabled]" value="0">
<input type="checkbox"
name="_mtee[wp_ver_disabled]" <?php checked($wp_ver_disabled, 1); ?>
value="1">削除
</label>
</div>
<div class="mtee-form-box">
<h3>CSS / JSバージョン情報</h3>
<label>
<input type="hidden" name="_mtee[asset_ver_disabled]" value="0">
<input type="checkbox"
name="_mtee[asset_ver_disabled]" <?php checked($asset_ver_disabled, 1); ?>
value="1">削除
</label>
</div>
<p class="submit"><input type="submit" name="Submit" class="button-primary" value="変更を保存"/></p>
</form>
<!-- /.wrap -->
</div>
-121
View File
@@ -1,121 +0,0 @@
<?php
$register_target = $this->register_target();
$opt = get_option('_mtee');
$keywords = $opt['top_page']['keywords'] ?? '';
$description = $opt['top_page']['description'] ?? '';
$noindex = $opt['top_page']['noindex'] ?? '0';
$nofollow = $opt['top_page']['nofollow'] ?? '0';
?>
<div class="wrap">
<h2>meta keyword, description / ページ設定</h2>
<?php if ($this->is_enable()): ?>
<form action="" method="post">
<?php wp_nonce_field('check_options'); ?>
<input type="hidden" name="_mtee[enabled]" value="1">
<h2>トップページ</h2>
<div class="mtee-form-box">
<table class="form-table">
<tr valign="top">
<th>meta keywords</th>
<td><input class="top_page_keywords" type="text" name="_mtee[top_page][keywords]"
value="<?php echo $keywords; ?>">
<br>キーワードはカンマ(,)区切りで入力してください
</td>
</tr>
<tr valign="top">
<th>meta description</th>
<td><input class="top_page_description" type="text" name="_mtee[top_page][description]"
value="<?php echo $description; ?>">
</td>
</tr>
<tr valign="top">
<th>noindex nofollow</th>
<td>
<div class="meta_noindex_nofollow_box">
<label>
<input type="hidden" name="_mtee[top_page][noindex]" value="0"/>
<input type="checkbox"
name="_mtee[top_page][noindex]" <?php checked($noindex, 1); ?>
value="1"/>
noindex
</label>
<label>
<input type="hidden" name="_mtee[top_page][nofollow]" value="0"/>
<input type="checkbox"
name="_mtee[top_page][nofollow]" <?php checked($nofollow, 1); ?>
value="1"/>
nofollow
</label>
</div>
</td>
</tr>
</table>
</div>
<p class="submit"><input type="submit" name="Submit" class="button-primary" value="変更を保存"/></p>
<?php if (count($register_target['custom_posts']) > 0): ?>
<h2>カスタム投稿アーカイブ</h2>
<?php foreach ($register_target['custom_posts'] as $custom_post): ?>
<?php
$keywords = $opt['custom_post'][$custom_post]['keywords'] ?? '';
$description = $opt['custom_post'][$custom_post]['description'] ?? '';
$noindex = $opt['custom_post'][$custom_post]['noindex'] ?? '0';
$nofollow = $opt['custom_post'][$custom_post]['nofollow'] ?? '0';
?>
<?php wp_nonce_field('check_options'); ?>
<div class="mtee-form-box">
<h3>
<?php echo get_post_type_object($custom_post)->label; ?>
<?php echo $custom_post; ?>
</h3>
<table class="form-table">
<tr valign="top">
<th>meta keywords</th>
<td><input class="top_page_keywords" type="text"
name="_mtee[custom_post][<?php echo $custom_post; ?>][keywords]"
value="<?php echo $keywords; ?>">
<br>キーワードはカンマ(,)区切りで入力してください
</td>
</tr>
<tr valign="top">
<th>meta description</th>
<td><input class="top_page_description" type="text"
name="_mtee[custom_post][<?php echo $custom_post; ?>][description]"
value="<?php echo $description; ?>">
</td>
</tr>
<tr valign="top">
<th>noindex nofollow</th>
<td>
<div class="meta_noindex_nofollow_box">
<label>
<input type="hidden"
name="_mtee[custom_post][<?php echo $custom_post; ?>][noindex]"
value="0"/>
<input type="checkbox"
name="_mtee[custom_post][<?php echo $custom_post; ?>][noindex]" <?php checked($noindex, 1); ?>
value="1"/>
noindex
</label>
<label>
<input type="hidden"
name="_mtee[custom_post][<?php echo $custom_post; ?>][nofollow]"
value="0"/>
<input type="checkbox"
name="_mtee[custom_post][<?php echo $custom_post; ?>][nofollow]" <?php checked($nofollow, 1); ?>
value="1"/>
nofollow
</label>
</div>
</td>
</tr>
</table>
</div>
<p class="submit"><input type="submit" name="Submit" class="button-primary" value="変更を保存"/></p>
<?php endforeach; ?>
</form>
<?php endif; ?>
<!-- /.wrap -->
<?php else: ?>
<h3>全体設定を有効にしてください</h3>
<?php endif; ?>
</div>