WP PLUGIN MTEE(Meta Tag etc Extend) タブコンテンツ表示調整など
・更新ボタン押下後、元のタブコンテンツを表示するよう修正 ・トップとアーカイブのOGP登録について未定義時の判定を追加 ・保存完了ダイアログに閉じるボタンを追加
This commit is contained in:
+8
-3
@@ -81,9 +81,14 @@ if (!class_exists('MTEE')) {
|
||||
|
||||
public function get_ogp_img($type, $subtype = '') {
|
||||
if (empty($subtype)) {
|
||||
$id = get_option('_mtee')[$type]['ogp_img'];
|
||||
} else {
|
||||
$id = get_option('_mtee')[$type][$subtype]['ogp_img'];
|
||||
if (isset(get_option('_mtee')[$type]['ogp_img'])) {
|
||||
$id = get_option('_mtee')[$type]['ogp_img'];
|
||||
}
|
||||
}
|
||||
if (!empty($subtype)) {
|
||||
if (isset(get_option('_mtee')[$type][$subtype]['ogp_img'])) {
|
||||
$id = get_option('_mtee')[$type][$subtype]['ogp_img'];
|
||||
}
|
||||
}
|
||||
if (!empty($id)) {
|
||||
return '<img src="' . wp_get_attachment_image_src($id, 'thumbnail')[0] . '">';
|
||||
|
||||
+28
-9
@@ -6,15 +6,34 @@ jQuery(function ($) {
|
||||
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();
|
||||
}
|
||||
});
|
||||
|
||||
init();
|
||||
click_menu();
|
||||
|
||||
function init() {
|
||||
let current_nav = $('#mtee_set_nav').val();
|
||||
let current_index = menu_list.index($('#' + current_nav));
|
||||
|
||||
$('.mtee_tab_menu li').removeClass('en');
|
||||
$('#' + current_nav).addClass('en');
|
||||
|
||||
content_box.hide();
|
||||
$('.mtee_tab_box:eq(' + current_index + ')').show();
|
||||
}
|
||||
|
||||
function click_menu() {
|
||||
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_set_nav').val($(this).attr('id'));
|
||||
$('.mtee_tab_box:eq(' + index + ')').show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,9 @@ 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');
|
||||
wp_enqueue_media(); //メディアアップローダーのためのスクリプト読み込み
|
||||
//メディアアップローダー
|
||||
wp_enqueue_media();
|
||||
|
||||
});
|
||||
|
||||
$mtee = new MTEE;
|
||||
|
||||
+7
-5
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
$register_targets = MTEE::register_target();
|
||||
$opt = get_option('_mtee');
|
||||
$mtee_set_nav = $_POST['mtee_set_nav'] ?? 'nav_metas';
|
||||
$enabled = $this->get_key_setting('enabled');
|
||||
$noindex_nofollow = $this->get_key_setting('noindex_nofollow');
|
||||
$ogp_setting = $this->get_key_setting('ogp_setting');
|
||||
@@ -14,15 +15,16 @@ $rss_disabled = $this->get_key_setting('rss_disabled');
|
||||
<h2>meta keyword, description / バージョン情報 設定</h2>
|
||||
<nav class="mtee_tab_menu">
|
||||
<ul>
|
||||
<li class="en">メタキーワード・ディスクリプション</li>
|
||||
<li>OGP</li>
|
||||
<li>noindex/nofollow</li>
|
||||
<li>Canonical</li>
|
||||
<li>バージョン情報等</li>
|
||||
<li id="nav_metas" class="en">メタキーワード・ディスクリプション</li>
|
||||
<li id="nav_ogp">OGP</li>
|
||||
<li id="nav_noindex">noindex/nofollow</li>
|
||||
<li id="nav_canonical">Canonical</li>
|
||||
<li id="nav_version">バージョン情報等</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<form action="" method="post">
|
||||
<?php wp_nonce_field('check_options'); ?>
|
||||
<input type="hidden" id="mtee_set_nav" name="mtee_set_nav" value="<?php echo $mtee_set_nav; ?>">
|
||||
<div class="mtee_tab_box">
|
||||
<div class="mtee-form-box">
|
||||
<h2>メタキーワード・ディスクリプション</h2>
|
||||
|
||||
@@ -1,225 +0,0 @@
|
||||
<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';
|
||||
$canonical_url = $opt['top_page']['canonical'] ?? '';
|
||||
$ogp_title = $opt['top_page']['ogp_title'] ?? '';
|
||||
$ogp_description = $opt['top_page']['ogp_description'] ?? '';
|
||||
$ogp_img = $opt['top_page']['ogp_img'] ?? '';
|
||||
?>
|
||||
<div class="mtee-form-box">
|
||||
<table class="form-table">
|
||||
<tr valign="top">
|
||||
<th>meta keywords
|
||||
<?php if (!$this->is_enable('enabled')): ?>
|
||||
<span class="disabled_status">※現在無効です</span>
|
||||
<?php endif; ?>
|
||||
</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
|
||||
<?php if (!$this->is_enable('enabled')): ?>
|
||||
<span class="disabled_status">※現在無効です</span>
|
||||
<?php endif; ?>
|
||||
</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
|
||||
<?php if (!$this->is_enable('noindex_nofollow')): ?>
|
||||
<span class="disabled_status">※現在無効です</span>
|
||||
<?php endif; ?>
|
||||
</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>
|
||||
<tr valign="top">
|
||||
<th>Canonical URL
|
||||
<?php if (!$this->is_enable('canonical_setting')): ?>
|
||||
<span class="disabled_status">※現在無効です</span>
|
||||
<?php endif; ?></th>
|
||||
<td><input class="top_page_description" type="text"
|
||||
name="_mtee[top_page][canonical]"
|
||||
value="<?php echo $canonical_url; ?>"
|
||||
placeholder="<?php echo get_bloginfo('url'); ?>">
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th>OGP title
|
||||
<?php if (!$this->is_enable('enabled')): ?>
|
||||
<span class="disabled_status">※現在無効です</span>
|
||||
<?php endif; ?>
|
||||
</th>
|
||||
<td><input class="top_page_keywords" type="text" name="_mtee[top_page][ogp_title]"
|
||||
value="<?php echo $ogp_title; ?>">
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th>OGP description
|
||||
<?php if (!$this->is_enable('enabled')): ?>
|
||||
<span class="disabled_status">※現在無効です</span>
|
||||
<?php endif; ?>
|
||||
</th>
|
||||
<td><input class="top_page_description" type="text" name="_mtee[top_page][ogp_description]"
|
||||
value="<?php echo $ogp_description; ?>">
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th>OGP Image</th>
|
||||
<td>
|
||||
<input class="<?php echo MTEE_OGP_IMG; ?>" name="_mtee[top_page][ogp_img]" type="hidden"
|
||||
value="<?php echo $ogp_img; ?>"/>
|
||||
<input type="button" class="select_ogp_img" name="select_ogp_img" value="選択"/>
|
||||
<input type="button" class="clear_ogp_img" name="clear_ogp_img" value="クリア"/>
|
||||
<div class="ogp_media"><?php echo $this->get_ogp_img('top_page'); ?></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';
|
||||
$canonical_url = $opt['custom_post'][$custom_post]['canonical'] ?? '';
|
||||
$ogp_title = $opt['custom_post'][$custom_post]['ogp_title'] ?? '';
|
||||
$ogp_description = $opt['custom_post'][$custom_post]['ogp_description'] ?? '';
|
||||
$ogp_img = $opt['custom_post'][$custom_post]['ogp_img'] ?? '';
|
||||
?>
|
||||
<?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
|
||||
<?php if (!$this->is_enable('enabled')): ?>
|
||||
<span class="disabled_status">※現在無効です</span>
|
||||
<?php endif; ?></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
|
||||
<?php if (!$this->is_enable('enabled')): ?>
|
||||
<span class="disabled_status">※現在無効です</span>
|
||||
<?php endif; ?></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
|
||||
<?php if (!$this->is_enable('noindex_nofollow')): ?>
|
||||
<span class="disabled_status">※現在無効です</span>
|
||||
<?php endif; ?></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>
|
||||
<tr valign="top">
|
||||
<th>Canonical URL
|
||||
<?php if (!$this->is_enable('canonical_setting')): ?>
|
||||
<span class="disabled_status">※現在無効です</span>
|
||||
<?php endif; ?></th>
|
||||
<td><input class="top_page_description" type="text"
|
||||
name="_mtee[custom_post][<?php echo $custom_post; ?>][canonical]"
|
||||
value="<?php echo $canonical_url; ?>"
|
||||
placeholder="<?php echo get_post_type_archive_link($custom_post); ?>">
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th>OGP keywords
|
||||
<?php if (!$this->is_enable('enabled')): ?>
|
||||
<span class="disabled_status">※現在無効です</span>
|
||||
<?php endif; ?></th>
|
||||
<td><input class="top_page_keywords" type="text"
|
||||
name="_mtee[custom_post][<?php echo $custom_post; ?>][ogp_title]"
|
||||
value="<?php echo $ogp_title; ?>">
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th>OGP description
|
||||
<?php if (!$this->is_enable('enabled')): ?>
|
||||
<span class="disabled_status">※現在無効です</span>
|
||||
<?php endif; ?></th>
|
||||
<td><input class="top_page_description" type="text"
|
||||
name="_mtee[custom_post][<?php echo $custom_post; ?>][ogp_description]"
|
||||
value="<?php echo $ogp_description; ?>">
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th>OGP Image</th>
|
||||
<td>
|
||||
<input class="<?php echo MTEE_OGP_IMG; ?>"
|
||||
name="_mtee[custom_post][<?php echo $custom_post; ?>][ogp_img]"
|
||||
type="hidden"
|
||||
value="<?php echo $ogp_img; ?>"/>
|
||||
<input type="button" class="select_ogp_img" name="select_ogp_img" value="選択"/>
|
||||
<input type="button" class="clear_ogp_img" name="clear_ogp_img" value="クリア"/>
|
||||
<div class="ogp_media"><?php echo $this->get_ogp_img('custom_post', $custom_post); ?></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
<p class="submit"><input type="submit" name="Submit" class="button-primary" value="変更を保存"/></p>
|
||||
<script>
|
||||
var ogp_img_name = "<?php echo MTEE_OGP_IMG; ?>"
|
||||
</script>
|
||||
|
||||
@@ -1 +1 @@
|
||||
<div class="updated fade"><p><strong>設定を保存しました</strong></p></div>
|
||||
<div id="settings_updated" class="updated notice is-dismissible"><p><strong>設定を保存しました</strong></p></div>
|
||||
|
||||
Reference in New Issue
Block a user