Skip to content

Commit

Permalink
カスタムフィールドのコード修正(プラグインとの競合の可能性を減らす)
Browse files Browse the repository at this point in the history
  • Loading branch information
yhira committed Mar 20, 2017
1 parent 77f247f commit f0fa867
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 51 deletions.
100 changes: 50 additions & 50 deletions lib/custom-field.php
Expand Up @@ -54,19 +54,19 @@ function view_comment_custom_box(){
function save_comment_custom_data(){
$id = get_the_ID();
//コメント凍結
$is_comment_form_freeze = null;
if ( isset( $_POST['is_comment_form_freeze'] ) )
if ( isset( $_POST['is_comment_form_freeze'] ) ){
$is_comment_form_freeze = $_POST['is_comment_form_freeze'];
$is_comment_form_freeze_key = 'is_comment_form_freeze';
add_post_meta($id, $is_comment_form_freeze_key, $is_comment_form_freeze, true);
update_post_meta($id, $is_comment_form_freeze_key, $is_comment_form_freeze);
$is_comment_form_freeze_key = 'is_comment_form_freeze';
add_post_meta($id, $is_comment_form_freeze_key, $is_comment_form_freeze, true);
update_post_meta($id, $is_comment_form_freeze_key, $is_comment_form_freeze);
}
//コメント凍結メッセージ
$comment_form_freeze_message = null;
if ( isset( $_POST['comment_form_freeze_message'] ) )
if ( isset( $_POST['comment_form_freeze_message'] ) ){
$comment_form_freeze_message = $_POST['comment_form_freeze_message'];
$comment_form_freeze_message_key = 'comment_form_freeze_message';
add_post_meta($id, $comment_form_freeze_message_key, $comment_form_freeze_message, true);
update_post_meta($id, $comment_form_freeze_message_key, $comment_form_freeze_message);
$comment_form_freeze_message_key = 'comment_form_freeze_message';
add_post_meta($id, $comment_form_freeze_message_key, $comment_form_freeze_message, true);
update_post_meta($id, $comment_form_freeze_message_key, $comment_form_freeze_message);
}
}

//コメント欄を凍結するか
Expand Down Expand Up @@ -95,12 +95,12 @@ function view_ad_custom_box(){
function save_ad_custom_data(){
$id = get_the_ID();
//広告の除外
$is_ads_removed_in_page = null;
if ( isset( $_POST['is_ads_removed_in_page'] ) )
if ( isset( $_POST['is_ads_removed_in_page'] ) ){
$is_ads_removed_in_page = $_POST['is_ads_removed_in_page'];
$is_ads_removed_in_page_key = 'is_ads_removed_in_page';
add_post_meta($id, $is_ads_removed_in_page_key, $is_ads_removed_in_page, true);
update_post_meta($id, $is_ads_removed_in_page_key, $is_ads_removed_in_page);
$is_ads_removed_in_page_key = 'is_ads_removed_in_page';
add_post_meta($id, $is_ads_removed_in_page_key, $is_ads_removed_in_page, true);
update_post_meta($id, $is_ads_removed_in_page_key, $is_ads_removed_in_page);
}
}

//広告を除外しているか
Expand Down Expand Up @@ -157,40 +157,40 @@ function view_seo_custom_box(){
function save_seo_custom_data(){
$id = get_the_ID();
//タイトル
$seo_title = null;
if ( isset( $_POST['seo_title'] ) )
if ( isset( $_POST['seo_title'] ) ){
$seo_title = $_POST['seo_title'];
$seo_title_key = 'seo_title';
add_post_meta($id, $seo_title_key, $seo_title, true);
update_post_meta($id, $seo_title_key, $seo_title);
$seo_title_key = 'seo_title';
add_post_meta($id, $seo_title_key, $seo_title, true);
update_post_meta($id, $seo_title_key, $seo_title);
}
//メタディスクリプション
$meta_description = null;
if ( isset( $_POST['meta_description'] ) )
if ( isset( $_POST['meta_description'] ) ){
$meta_description = $_POST['meta_description'];
$meta_description_key = 'meta_description';
add_post_meta($id, $meta_description_key, $meta_description, true);
update_post_meta($id, $meta_description_key, $meta_description);
$meta_description_key = 'meta_description';
add_post_meta($id, $meta_description_key, $meta_description, true);
update_post_meta($id, $meta_description_key, $meta_description);
}
//メタキーワード
$meta_keywords = null;
if ( isset( $_POST['meta_keywords'] ) )
if ( isset( $_POST['meta_keywords'] ) ){
$meta_keywords = $_POST['meta_keywords'];
$meta_keywords_key = 'meta_keywords';
add_post_meta($id, $meta_keywords_key, $meta_keywords, true);
update_post_meta($id, $meta_keywords_key, $meta_keywords);
$meta_keywords_key = 'meta_keywords';
add_post_meta($id, $meta_keywords_key, $meta_keywords, true);
update_post_meta($id, $meta_keywords_key, $meta_keywords);
}
//noindex
$is_noindex = null;
if ( isset( $_POST['is_noindex'] ) )
if ( isset( $_POST['is_noindex'] ) ){
$is_noindex = $_POST['is_noindex'];
$is_noindex_key = 'is_noindex';
add_post_meta($id, $is_noindex_key, $is_noindex, true);
update_post_meta($id, $is_noindex_key, $is_noindex);
$is_noindex_key = 'is_noindex';
add_post_meta($id, $is_noindex_key, $is_noindex, true);
update_post_meta($id, $is_noindex_key, $is_noindex);
}
//nofollow
$is_nofollow = null;
if ( isset( $_POST['is_nofollow'] ) )
if ( isset( $_POST['is_nofollow'] ) ){
$is_nofollow = $_POST['is_nofollow'];
$is_nofollow_key = 'is_nofollow';
add_post_meta($id, $is_nofollow_key, $is_nofollow, true);
update_post_meta($id, $is_nofollow_key, $is_nofollow);
$is_nofollow_key = 'is_nofollow';
add_post_meta($id, $is_nofollow_key, $is_nofollow, true);
update_post_meta($id, $is_nofollow_key, $is_nofollow);
}
}

//SEO向けのタイトルを取得
Expand Down Expand Up @@ -272,12 +272,12 @@ function view_page_custom_box(){
function save_page_custom_data(){
$id = get_the_ID();
//ページタイプ
$page_type = null;
if ( isset( $_POST['page_type'] ) )
if ( isset( $_POST['page_type'] ) ){
$page_type = $_POST['page_type'];
$page_type_key = 'page_type';
add_post_meta($id, $page_type_key, $page_type, true);
update_post_meta($id, $page_type_key, $page_type);
$page_type_key = 'page_type';
add_post_meta($id, $page_type_key, $page_type, true);
update_post_meta($id, $page_type_key, $page_type);
}
}

//ページタイプの取得
Expand Down Expand Up @@ -363,12 +363,12 @@ function save_amp_custom_data(){
$id = get_the_ID();

//AMPを有効化するか
$is_noamp = null;
if ( isset( $_POST['is_noamp'] ) )
if ( isset( $_POST['is_noamp'] ) ){
$is_noamp = $_POST['is_noamp'];
$is_noamp_key = 'is_noamp';
add_post_meta($id, $is_noamp_key, $is_noamp, true);
update_post_meta($id, $is_noamp_key, $is_noamp);
$is_noamp_key = 'is_noamp';
add_post_meta($id, $is_noamp_key, $is_noamp, true);
update_post_meta($id, $is_noamp_key, $is_noamp);
}
}


Expand Down
2 changes: 1 addition & 1 deletion style.css
Expand Up @@ -6,7 +6,7 @@ Theme URI: https://wp-simplicity.com/
Author: yhira
Author URI: http://nelog.jp/
Text Domain: simplicity2
Version: 2.5.0c
Version: 2.5.0d
Tags: two-columns, left-sidebar, right-sidebar
License: GNU General Public License
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down

0 comments on commit f0fa867

Please sign in to comment.