From 151026ef878ace0e5fd8dad0b2dbd7b2c8896afb Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 28 May 2021 21:06:37 +0900 Subject: [PATCH] =?UTF-8?q?WP=20PLUGIN=20MTEE(Meta=20Tag=20etc=20Extend)?= =?UTF-8?q?=20OGP=E3=82=BF=E3=82=B0=E8=A8=AD=E5=AE=9A=E3=81=AE=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ・language_attributesフックでhtmlタグにprefixを追加 --- class/mtee-ogp-setting.php | 52 ++++++++++++++++++++++++++++++++++++++ class/mtee-output-ogp.php | 30 ++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 class/mtee-ogp-setting.php create mode 100644 class/mtee-output-ogp.php diff --git a/class/mtee-ogp-setting.php b/class/mtee-ogp-setting.php new file mode 100644 index 0000000..bcd5c3f --- /dev/null +++ b/class/mtee-ogp-setting.php @@ -0,0 +1,52 @@ + array('page', 'post',), + ); + + foreach ($default_built_ins['posts'] as $built_in) { + add_meta_box( + 'canonical_setting', + 'Canonical設定', + array($this, 'insert_meta_fields'), + $built_in, + 'normal' + ); + } + + if (isset($this->options['custom_posts'])) { + foreach ($this->options['custom_posts'] as $custom_post => $post_chk) { + if ($post_chk == 1) { + add_meta_box( + 'canonical_setting', + 'Canonical設定', + array($this, 'insert_meta_fields'), + $custom_post, 'normal' + ); + } + } + } + } + + } + +} \ No newline at end of file diff --git a/class/mtee-output-ogp.php b/class/mtee-output-ogp.php new file mode 100644 index 0000000..cff6e84 --- /dev/null +++ b/class/mtee-output-ogp.php @@ -0,0 +1,30 @@ +create_ogp_prefix(); + return $output; + } + + private function create_ogp_prefix(): string { + return ' prefix="og: https://ogp.me/ns#"'; + } + } +} \ No newline at end of file