From da6cc8f734f89672442e894794e734199d2cc8f6 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 12 Jun 2021 16:53:55 +0900 Subject: [PATCH] =?UTF-8?q?WP=20PLUGIN=20MTEE(Meta=20Tag=20etc=20Extend)?= =?UTF-8?q?=20=E3=82=BF=E3=83=96=E3=82=B3=E3=83=B3=E3=83=86=E3=83=B3?= =?UTF-8?q?=E3=83=84=E8=A1=A8=E7=A4=BA=E8=AA=BF=E6=95=B4=E3=81=AA=E3=81=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ・更新ボタン押下後、元のタブコンテンツを表示するよう修正 ・トップとアーカイブのOGP登録について未定義時の判定を追加 ・保存完了ダイアログに閉じるボタンを追加 --- class/mtee.php | 11 +- js/mtee.js | 37 +++++-- meta-tag-etc-extend.php | 4 +- template/index.php | 12 ++- template/pages_other.php | 225 --------------------------------------- template/success.php | 2 +- 6 files changed, 47 insertions(+), 244 deletions(-) delete mode 100644 template/pages_other.php diff --git a/class/mtee.php b/class/mtee.php index 54cce1d..f283527 100644 --- a/class/mtee.php +++ b/class/mtee.php @@ -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 ''; diff --git a/js/mtee.js b/js/mtee.js index 99129a9..bd13375 100644 --- a/js/mtee.js +++ b/js/mtee.js @@ -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(); + } + }); + } + } diff --git a/meta-tag-etc-extend.php b/meta-tag-etc-extend.php index a6ea290..a1addd6 100644 --- a/meta-tag-etc-extend.php +++ b/meta-tag-etc-extend.php @@ -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; diff --git a/template/index.php b/template/index.php index 00371c9..0436bdd 100644 --- a/template/index.php +++ b/template/index.php @@ -1,6 +1,7 @@ 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');

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

+

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

diff --git a/template/pages_other.php b/template/pages_other.php deleted file mode 100644 index 97ef1cf..0000000 --- a/template/pages_other.php +++ /dev/null @@ -1,225 +0,0 @@ -

トップページ

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
meta keywords - is_enable('enabled')): ?> - ※現在無効です - - -
キーワードはカンマ(,)区切りで入力してください -
meta description - is_enable('enabled')): ?> - ※現在無効です - - -
noindex nofollow - is_enable('noindex_nofollow')): ?> - ※現在無効です - - -
- - -
-
Canonical URL - is_enable('canonical_setting')): ?> - ※現在無効です - -
OGP title - is_enable('enabled')): ?> - ※現在無効です - - -
OGP description - is_enable('enabled')): ?> - ※現在無効です - - -
OGP Image - - - -
get_ogp_img('top_page'); ?>
-
-
- 0): ?> -

カスタム投稿アーカイブ

- - - -
-

- label; ?> - () -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
meta keywords - is_enable('enabled')): ?> - ※現在無効です - -
キーワードはカンマ(,)区切りで入力してください -
meta description - is_enable('enabled')): ?> - ※現在無効です - -
noindex nofollow - is_enable('noindex_nofollow')): ?> - ※現在無効です - -
- - -
-
Canonical URL - is_enable('canonical_setting')): ?> - ※現在無効です - -
OGP keywords - is_enable('enabled')): ?> - ※現在無効です - -
OGP description - is_enable('enabled')): ?> - ※現在無効です - -
OGP Image - - - -
get_ogp_img('custom_post', $custom_post); ?>
-
-
- - -

- - diff --git a/template/success.php b/template/success.php index e97c95a..c91135f 100644 --- a/template/success.php +++ b/template/success.php @@ -1 +1 @@ -

設定を保存しました

\ No newline at end of file +

設定を保存しました