Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
sora
/
achievement
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4ebae9d0
authored
Apr 14, 2022
by
Orine Matsui
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
サーバのDL反映
parent
3d11edaa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
367 additions
and
327 deletions
achievement-official.conohawing.com/wp-content/themes/achievement/functions.php
achievement-official.conohawing.com/wp-content/themes/achievement/functions.php
View file @
4ebae9d0
<?php
<?php
/* ===============================================================================
/* ===============================================================================
総合設定ファイル
総合設定ファイル
=============================================================================== */
=============================================================================== */
/* ディレクトリ設定
/* ディレクトリ設定
------------------------------------------------------------------------------- */
------------------------------------------------------------------------------- */
$templatepath
=
get_template_directory
();
$templatepath
=
get_template_directory
();
define
(
'T_LIBS'
,
$templatepath
.
'/libs/'
);
define
(
'T_LIBS'
,
$templatepath
.
'/libs/'
);
define
(
'T_THEME'
,
get_template_directory_uri
());
define
(
'T_THEME'
,
get_template_directory_uri
());
/* 管理エディターのスタイルシートを登録します
/* 管理エディターのスタイルシートを登録します
/*---------------------------------------------------------*/
/*---------------------------------------------------------*/
add_action
(
'admin_init'
,
'my_theme_add_editor_style'
);
add_action
(
'admin_init'
,
'my_theme_add_editor_style'
);
function
my_theme_add_editor_style
()
{
function
my_theme_add_editor_style
()
{
add_editor_style
(
'assets/css/content.css'
);
add_editor_style
(
'assets/css/content.css'
);
}
}
/* カスタム投稿
/* カスタム投稿
------------------------------------------------------------------------------- */
------------------------------------------------------------------------------- */
add_action
(
'init'
,
'create_post_type'
);
add_action
(
'init'
,
'create_post_type'
);
function
create_post_type
()
function
create_post_type
()
{
{
register_post_type
(
'news'
,
[
// 投稿タイプ名の定義
register_post_type
(
'news'
,
[
// 投稿タイプ名の定義
'labels'
=>
[
'labels'
=>
[
'name'
=>
'ニュース'
,
// 管理画面上で表示する投稿タイプ名
'name'
=>
'ニュース'
,
// 管理画面上で表示する投稿タイプ名
'singular_name'
=>
'news'
,
// カスタム投稿の識別名
'singular_name'
=>
'news'
,
// カスタム投稿の識別名
],
],
'public'
=>
true
,
// 投稿タイプをpublicにするか
'public'
=>
true
,
// 投稿タイプをpublicにするか
'has_archive'
=>
true
,
// アーカイブ機能ON/OFF
'has_archive'
=>
true
,
// アーカイブ機能ON/OFF
'menu_position'
=>
4
,
// 管理画面上での配置場所
'menu_position'
=>
4
,
// 管理画面上での配置場所
'show_in_rest'
=>
true
,
// 5系から出てきた新エディタ「Gutenberg」を有効にする
'show_in_rest'
=>
true
,
// 5系から出てきた新エディタ「Gutenberg」を有効にする
'supports'
=>
array
(
'title'
,
'editor'
,
'thumbnail'
),
'supports'
=>
array
(
'title'
,
'editor'
,
'thumbnail'
),
'slug'
=>
'news'
,
'slug'
=>
'news'
,
'rewrite'
=>
array
(
'slug'
=>
'news'
,
'with_front'
=>
false
),
'rewrite'
=>
array
(
'slug'
=>
'news'
,
'with_front'
=>
false
),
'taxonomy'
=>
'news_tax'
,
'taxonomy'
=>
'news_tax'
,
]);
]);
$args
=
array
(
$args
=
array
(
'label'
=>
__
(
'カテゴリー'
,
'achievement'
),
'label'
=>
__
(
'カテゴリー'
,
'achievement'
),
'public'
=>
true
,
'public'
=>
true
,
'hierarchical'
=>
true
,
'hierarchical'
=>
true
,
'rewrite'
=>
array
(
'slug'
=>
'news'
,
'with_front'
=>
false
),
'rewrite'
=>
array
(
'slug'
=>
'news'
,
'with_front'
=>
false
),
);
);
register_taxonomy
(
'news_tax'
,
'news'
,
$args
);
register_taxonomy
(
'news_tax'
,
'news'
,
$args
);
register_post_type
(
'case'
,
[
register_post_type
(
'case'
,
[
'labels'
=>
[
'labels'
=>
[
'name'
=>
'お客様事例'
,
'name'
=>
'お客様事例'
,
'singular_name'
=>
'case'
,
'singular_name'
=>
'case'
,
],
],
'public'
=>
true
,
'public'
=>
true
,
'has_archive'
=>
true
,
'has_archive'
=>
true
,
'menu_position'
=>
3
,
'menu_position'
=>
3
,
'show_in_rest'
=>
true
,
'show_in_rest'
=>
true
,
]);
]);
$args
=
array
(
$args
=
array
(
'label'
=>
__
(
'カテゴリー'
,
'case'
),
'label'
=>
__
(
'カテゴリー'
,
'case'
),
'public'
=>
true
,
'public'
=>
true
,
'hierarchical'
=>
true
,
'hierarchical'
=>
true
,
'rewrite'
=>
array
(
'slug'
=>
'case'
,
'with_front'
=>
false
),
'rewrite'
=>
array
(
'slug'
=>
'case'
,
'with_front'
=>
false
),
);
);
register_taxonomy
(
'case_tax'
,
'case'
,
$args
);
register_taxonomy
(
'case_tax'
,
'case'
,
$args
);
register_post_type
(
'trainer'
,
[
register_post_type
(
'trainer'
,
[
'labels'
=>
[
'labels'
=>
[
'name'
=>
'講師紹介'
,
'name'
=>
'講師紹介'
,
'singular_name'
=>
'trainer'
,
'singular_name'
=>
'trainer'
,
],
],
'public'
=>
true
,
'public'
=>
true
,
'has_archive'
=>
true
,
'has_archive'
=>
true
,
'menu_position'
=>
7
,
'menu_position'
=>
7
,
'show_in_rest'
=>
true
,
'show_in_rest'
=>
true
,
]);
]);
$args
=
array
(
$args
=
array
(
'label'
=>
__
(
'カテゴリー'
,
'trainer'
),
'label'
=>
__
(
'カテゴリー'
,
'trainer'
),
'public'
=>
true
,
'public'
=>
true
,
'hierarchical'
=>
true
,
'hierarchical'
=>
true
,
'rewrite'
=>
array
(
'slug'
=>
'trainer'
,
'with_front'
=>
false
),
'rewrite'
=>
array
(
'slug'
=>
'trainer'
,
'with_front'
=>
false
),
);
);
register_taxonomy
(
'trainer_tax'
,
'trainer'
,
$args
);
register_taxonomy
(
'trainer_tax'
,
'trainer'
,
$args
);
register_post_type
(
'experience'
,
[
register_post_type
(
'experience'
,
[
'labels'
=>
[
'labels'
=>
[
'name'
=>
'講演会'
,
'name'
=>
'講演会'
,
'singular_name'
=>
'experience'
,
'singular_name'
=>
'experience'
,
],
],
'public'
=>
true
,
'public'
=>
true
,
'has_archive'
=>
true
,
'has_archive'
=>
true
,
'menu_position'
=>
8
,
'menu_position'
=>
8
,
'show_in_rest'
=>
true
,
'show_in_rest'
=>
true
,
]);
]);
$args
=
array
(
$args
=
array
(
'label'
=>
__
(
'カテゴリー'
,
'experience'
),
'label'
=>
__
(
'カテゴリー'
,
'experience'
),
'public'
=>
true
,
'public'
=>
true
,
'hierarchical'
=>
true
,
'hierarchical'
=>
true
,
'rewrite'
=>
array
(
'slug'
=>
'experience'
,
'with_front'
=>
false
),
'rewrite'
=>
array
(
'slug'
=>
'experience'
,
'with_front'
=>
false
),
);
);
register_taxonomy
(
'experience_tax'
,
'experience'
,
$args
);
register_taxonomy
(
'experience_tax'
,
'experience'
,
$args
);
register_post_type
(
'faq'
,
[
register_post_type
(
'faq'
,
[
'labels'
=>
[
'labels'
=>
[
'name'
=>
'よくある質問'
,
'name'
=>
'よくある質問'
,
'singular_name'
=>
'faq'
,
'singular_name'
=>
'faq'
,
],
],
'public'
=>
true
,
'public'
=>
true
,
'has_archive'
=>
true
,
'has_archive'
=>
true
,
'menu_position'
=>
9
,
'menu_position'
=>
9
,
'show_in_rest'
=>
true
,
'show_in_rest'
=>
true
,
]);
]);
$args
=
array
(
$args
=
array
(
'label'
=>
__
(
'カテゴリー'
,
'faq'
),
'label'
=>
__
(
'カテゴリー'
,
'faq'
),
'public'
=>
true
,
'public'
=>
true
,
'hierarchical'
=>
true
,
'hierarchical'
=>
true
,
'rewrite'
=>
array
(
'slug'
=>
'faq'
,
'with_front'
=>
false
),
'rewrite'
=>
array
(
'slug'
=>
'faq'
,
'with_front'
=>
false
),
);
);
register_taxonomy
(
'faq_tax'
,
'faq'
,
$args
);
register_taxonomy
(
'faq_tax'
,
'faq'
,
$args
);
register_post_type
(
'seminar'
,
[
register_post_type
(
'seminar'
,
[
'labels'
=>
[
'labels'
=>
[
'name'
=>
'セミナー'
,
'name'
=>
'セミナー'
,
'singular_name'
=>
'seminar'
,
'singular_name'
=>
'seminar'
,
],
],
'public'
=>
true
,
'public'
=>
true
,
'has_archive'
=>
true
,
'has_archive'
=>
true
,
'menu_position'
=>
10
,
'menu_position'
=>
10
,
'show_in_rest'
=>
true
,
'show_in_rest'
=>
true
,
]);
]);
$args
=
array
(
$args
=
array
(
'label'
=>
__
(
'カテゴリー'
,
'seminar'
),
'label'
=>
__
(
'カテゴリー'
,
'seminar'
),
'public'
=>
true
,
'public'
=>
true
,
'hierarchical'
=>
true
,
'hierarchical'
=>
true
,
'rewrite'
=>
array
(
'slug'
=>
'seminar'
,
'with_front'
=>
false
),
'rewrite'
=>
array
(
'slug'
=>
'seminar'
,
'with_front'
=>
false
),
);
);
register_taxonomy
(
'seminar_tax'
,
'seminar'
,
$args
);
register_taxonomy
(
'seminar_tax'
,
'seminar'
,
$args
);
}
}
add_theme_support
(
'post-thumbnails'
);
add_theme_support
(
'post-thumbnails'
);
set_post_thumbnail_size
(
600
,
346
,
true
);
set_post_thumbnail_size
(
600
,
346
,
true
);
/*【管理画面】ACF Options Page の設定 */
/*【管理画面】ACF Options Page の設定 */
if
(
function_exists
(
'acf_add_options_page'
))
{
if
(
function_exists
(
'acf_add_options_page'
))
{
acf_add_options_page
(
array
(
acf_add_options_page
(
array
(
'page_title'
=>
'UpdateText'
,
// ページタイトル
'page_title'
=>
'UpdateText'
,
// ページタイトル
'menu_title'
=>
'一括更新テキスト'
,
// メニュータイトル
'menu_title'
=>
'一括更新テキスト'
,
// メニュータイトル
'menu_slug'
=>
'update-text'
,
// メニュースラッグ
'menu_slug'
=>
'update-text'
,
// メニュースラッグ
'capability'
=>
'edit_posts'
,
'capability'
=>
'edit_posts'
,
'redirect'
=>
false
'redirect'
=>
false
));
));
}
}
// 「講演会」本文エディタ削除
// 「講演会」本文エディタ削除
function
my_remove_post_support
()
function
my_remove_post_support
()
{
{
remove_post_type_support
(
'experience'
,
'editor'
);
remove_post_type_support
(
'experience'
,
'editor'
);
}
}
add_action
(
'init'
,
'my_remove_post_support'
);
add_action
(
'init'
,
'my_remove_post_support'
);
/*===================================
/*===================================
OGPタグ
mark new post
===================================*/
===================================*/
function
my_meta_ogp
()
{
function
mark_new_post
(
$days
)
if
(
is_front_page
()
||
is_home
()
||
is_singular
()
){
{
global
$post
;
$today
=
date_i18n
(
'U'
);
$ogp_title
=
''
;
$entry_day
=
get_the_time
(
'U'
);
$ogp_descr
=
''
;
$post_day
=
date
(
'U'
,
(
$today
-
$entry_day
))
/
86400
;
$ogp_url
=
''
;
if
(
$days
>
$post_day
)
:
$ogp_img
=
''
;
echo
'<p class="c-list1__tag"><span>会社情報</span></p>'
;
$insert
=
''
;
endif
;
}
if
(
is_singular
()
)
{
//記事&固定ページ
setup_postdata
(
$post
);
//auto check taxonomy custom post news
$ogp_title
=
$post
->
post_title
;
function
mfields_set_default_object_terms
(
$post_id
,
$post
)
$ogp_descr
=
mb_substr
(
get_the_excerpt
(),
0
,
100
);
{
$ogp_url
=
get_permalink
();
if
(
'publish'
===
$post
->
post_status
&&
$post
->
post_type
===
'news'
)
{
wp_reset_postdata
();
$defaults
=
array
(
}
elseif
(
is_front_page
()
||
is_home
()
)
{
//トップページ
'news_tax'
=>
array
(
'info'
)
$ogp_title
=
get_bloginfo
(
'name'
);
);
$ogp_descr
=
get_bloginfo
(
'description'
);
$taxonomies
=
get_object_taxonomies
(
$post
->
post_type
);
$ogp_url
=
home_url
();
}
foreach
((
array
)
$taxonomies
as
$taxonomy
)
{
$terms
=
wp_get_post_terms
(
$post_id
,
$taxonomy
);
//og:type
if
(
empty
(
$terms
)
&&
array_key_exists
(
$taxonomy
,
$defaults
))
{
$ogp_type
=
(
is_front_page
()
||
is_home
()
)
?
'website'
:
'article'
;
wp_set_object_terms
(
$post_id
,
$defaults
[
$taxonomy
],
$taxonomy
);
}
//og:image
}
if
(
is_singular
()
&&
has_post_thumbnail
()
)
{
}
$ps_thumb
=
wp_get_attachment_image_src
(
get_post_thumbnail_id
(),
'full'
);
}
$ogp_img
=
$ps_thumb
[
0
];
}
else
{
add_action
(
'save_post'
,
'mfields_set_default_object_terms'
,
100
,
2
);
$ogp_img
=
'https://achievement.co.jp/assets/img/common/ogp.jpg'
;
}
// function tax_news($termlink, $term, $taxonomy)
//facebookのapp_id(設定する場合)$insert .= '<meta property="fb:app_id" content="ここにappIDを入力">' . "\n";
// {
// if ('news_tax' == $taxonomy)
echo
$insert
;
// return home_url() . '/news/' . $term->slug;
}
// return $termlink;
}
//END my_meta_ogp
// }
// add_filter('term_link', 'tax_news', 10, 3);
add_action
(
'wp_head'
,
'my_meta_ogp'
);
//headにOGPを出力
/*===================================
mark new post
// add_filter('request', 'rudr_change_term_request', 1, 1);
===================================*/
// add_filter('term_link', 'rudr_term_permalink', 10, 3);
function
mark_new_post
(
$days
)
// function rudr_change_term_request($query)
{
// {
$today
=
date_i18n
(
'U'
);
// $tax_name = 'news_tax';
$entry_day
=
get_the_time
(
'U'
);
// if ($query['attachment']) :
$post_day
=
date
(
'U'
,
(
$today
-
$entry_day
))
/
86400
;
// $include_children = true;
if
(
$days
>
$post_day
)
:
// $name = $query['attachment'];
echo
'<p class="c-list1__tag"><span>会社情報</span></p>'
;
// else :
endif
;
// $include_children = false;
}
// $name = $query['name'];
// endif;
//auto check taxonomy custom post news
// $term = get_term_by('slug', $name, $tax_name);
function
mfields_set_default_object_terms
(
$post_id
,
$post
)
// if (isset($name) && $term && !is_wp_error($term)) :
{
// if ($include_children) {
if
(
'publish'
===
$post
->
post_status
&&
$post
->
post_type
===
'news'
)
{
// unset($query['attachment']);
$defaults
=
array
(
// $parent = $term->parent;
'news_tax'
=>
array
(
'info'
)
// while ($parent) {
);
// $parent_term = get_term($parent, $tax_name);
$taxonomies
=
get_object_taxonomies
(
$post
->
post_type
);
// $name = $parent_term->slug . '/' . $name;
// $parent = $parent_term->parent;
foreach
((
array
)
$taxonomies
as
$taxonomy
)
{
// }
$terms
=
wp_get_post_terms
(
$post_id
,
$taxonomy
);
// } else {
if
(
empty
(
$terms
)
&&
array_key_exists
(
$taxonomy
,
$defaults
))
{
// unset($query['name']);
wp_set_object_terms
(
$post_id
,
$defaults
[
$taxonomy
],
$taxonomy
);
// }
}
// endif;
}
// return $query;
}
// }
}
// function rudr_term_permalink($url, $term, $taxonomy)
// {
add_action
(
'save_post'
,
'mfields_set_default_object_terms'
,
100
,
2
);
// $taxonomy_name = 'news_tax';
// $taxonomy_slug = 'news_tax';
// function tax_news($termlink, $term, $taxonomy)
// if (strpos($url, $taxonomy_slug) === FALSE || $taxonomy != $taxonomy_name) return $url;
// {
// $url = str_replace('/' . $taxonomy_slug, '', $url);
// if ('news_tax' == $taxonomy)
// return $url;
// return home_url() . '/news/' . $term->slug;
// }
// return $termlink;
// }
/*【管理画面】投稿メニューを非表示 */
// add_filter('term_link', 'tax_news', 10, 3);
add_action
(
'admin_menu'
,
'fc_my_remove_menus'
);
function
fc_my_remove_menus
()
{
// add_filter('request', 'rudr_change_term_request', 1, 1);
global
$menu
;
// add_filter('term_link', 'rudr_term_permalink', 10, 3);
remove_menu_page
(
'edit.php'
);
// function rudr_change_term_request($query)
}
// {
// $tax_name = 'news_tax';
// if ($query['attachment']) :
// Code viet lai rule cho taxonomy custom post type. Chỉ chạy 1 lần rồi xóa đi.
// $include_children = true;
// Code rewrite rule for taxonomy custom post type. Only run 1 time and then delete.
// $name = $query['attachment'];
function
generate_taxonomy_rewrite_rules
(
$wp_rewrite
)
// else :
{
// $include_children = false;
$rules
=
array
();
// $name = $query['name'];
$post_types
=
get_post_types
(
array
(
'public'
=>
true
,
'_builtin'
=>
false
),
'objects'
);
// endif;
$taxonomies
=
get_taxonomies
(
array
(
'public'
=>
true
,
'_builtin'
=>
false
),
'objects'
);
// $term = get_term_by('slug', $name, $tax_name);
foreach
(
$post_types
as
$post_type
)
{
// if (isset($name) && $term && !is_wp_error($term)) :
$post_type_name
=
$post_type
->
name
;
// if ($include_children) {
$post_type_slug
=
$post_type
->
rewrite
[
'slug'
];
// unset($query['attachment']);
// $parent = $term->parent;
foreach
(
$taxonomies
as
$taxonomy
)
{
// while ($parent) {
if
(
$taxonomy
->
object_type
[
0
]
==
$post_type_name
)
{
// $parent_term = get_term($parent, $tax_name);
$terms
=
get_categories
(
array
(
'type'
=>
$post_type_name
,
'taxonomy'
=>
$taxonomy
->
name
,
'hide_empty'
=>
0
));
// $name = $parent_term->slug . '/' . $name;
foreach
(
$terms
as
$term
)
{
// $parent = $parent_term->parent;
$rules
[
$post_type_slug
.
'/'
.
$term
->
slug
.
'/?$'
]
=
'index.php?'
.
$term
->
taxonomy
.
'='
.
$term
->
slug
;
// }
$rules
[
$post_type_slug
.
'/'
.
$term
->
slug
.
'/page/?([0-9]{1,})/?$'
]
=
'index.php?'
.
$term
->
taxonomy
.
'='
.
$term
->
slug
.
'&paged='
.
$wp_rewrite
->
preg_index
(
1
);
// } else {
}
// unset($query['name']);
}
// }
}
// endif;
}
// return $query;
$wp_rewrite
->
rules
=
$rules
+
$wp_rewrite
->
rules
;
// }
}
// function rudr_term_permalink($url, $term, $taxonomy)
// {
add_action
(
'generate_rewrite_rules'
,
'generate_taxonomy_rewrite_rules'
);
// $taxonomy_name = 'news_tax';
// $taxonomy_slug = 'news_tax';
// if (strpos($url, $taxonomy_slug) === FALSE || $taxonomy != $taxonomy_name) return $url;
/* その他設定
// $url = str_replace('/' . $taxonomy_slug, '', $url);
/*---------------------------------------------------------*/
// return $url;
add_action
(
'init'
,
'fc_disable_emoji'
);
// }
function
fc_disable_emoji
()
{
/*【管理画面】投稿メニューを非表示 */
remove_action
(
'wp_head'
,
'print_emoji_detection_script'
,
7
);
add_action
(
'admin_menu'
,
'fc_my_remove_menus'
);
remove_action
(
'admin_print_scripts'
,
'print_emoji_detection_script'
);
function
fc_my_remove_menus
()
remove_action
(
'wp_print_styles'
,
'print_emoji_styles'
);
{
remove_action
(
'admin_print_styles'
,
'print_emoji_styles'
);
global
$menu
;
remove_filter
(
'the_content_feed'
,
'wp_staticize_emoji'
);
remove_menu_page
(
'edit.php'
);
remove_filter
(
'comment_text_rss'
,
'wp_staticize_emoji'
);
}
remove_filter
(
'wp_mail'
,
'wp_staticize_emoji_for_email'
);
remove_action
(
'wp_head'
,
'wp_generator'
);
remove_action
(
'wp_head'
,
'wlwmanifest_link'
);
// Code viet lai rule cho taxonomy custom post type. Chỉ chạy 1 lần rồi xóa đi.
remove_action
(
'wp_head'
,
'rsd_link'
);
// Code rewrite rule for taxonomy custom post type. Only run 1 time and then delete.
remove_action
(
'wp_head'
,
'wp_shortlink_wp_head'
);
function
generate_taxonomy_rewrite_rules
(
$wp_rewrite
)
}
{
$rules
=
array
();
/* ログイン中にwpadminbar を表示
$post_types
=
get_post_types
(
array
(
'public'
=>
true
,
'_builtin'
=>
false
),
'objects'
);
/*---------------------------------------------------------*/
$taxonomies
=
get_taxonomies
(
array
(
'public'
=>
true
,
'_builtin'
=>
false
),
'objects'
);
add_filter
(
'show_admin_bar'
,
'fc_hidden_admin_bar'
);
foreach
(
$post_types
as
$post_type
)
{
function
fc_hidden_admin_bar
()
$post_type_name
=
$post_type
->
name
;
{
$post_type_slug
=
$post_type
->
rewrite
[
'slug'
];
return
false
;
}
foreach
(
$taxonomies
as
$taxonomy
)
{
if
(
$taxonomy
->
object_type
[
0
]
==
$post_type_name
)
{
add_action
(
'admin_head'
,
'fc_hiden_aiosp_custom_link_wrapper'
);
$terms
=
get_categories
(
array
(
'type'
=>
$post_type_name
,
'taxonomy'
=>
$taxonomy
->
name
,
'hide_empty'
=>
0
));
function
fc_hiden_aiosp_custom_link_wrapper
()
foreach
(
$terms
as
$term
)
{
{
$rules
[
$post_type_slug
.
'/'
.
$term
->
slug
.
'/?$'
]
=
'index.php?'
.
$term
->
taxonomy
.
'='
.
$term
->
slug
;
echo
'<style>
$rules
[
$post_type_slug
.
'/'
.
$term
->
slug
.
'/page/?([0-9]{1,})/?$'
]
=
'index.php?'
.
$term
->
taxonomy
.
'='
.
$term
->
slug
.
'&paged='
.
$wp_rewrite
->
preg_index
(
1
);
#aiosp_custom_link_wrapper {
}
display: none !important;
}
}
}
</style>'
;
}
}
$wp_rewrite
->
rules
=
$rules
+
$wp_rewrite
->
rules
;
}
add_filter
(
'aioseop_canonical_url'
,
'fc_custom_aioseop_canonical_url'
);
function
fc_custom_aioseop_canonical_url
(
$url
)
add_action
(
'generate_rewrite_rules'
,
'generate_taxonomy_rewrite_rules'
);
{
if
(
is_page
()
||
is_single
())
{
return
get_permalink
();
/* その他設定
}
/*---------------------------------------------------------*/
add_action
(
'init'
,
'fc_disable_emoji'
);
return
$url
;
function
fc_disable_emoji
()
}
{
remove_action
(
'wp_head'
,
'print_emoji_detection_script'
,
7
);
remove_action
(
'admin_print_scripts'
,
'print_emoji_detection_script'
);
remove_action
(
'wp_print_styles'
,
'print_emoji_styles'
);
remove_action
(
'admin_print_styles'
,
'print_emoji_styles'
);
remove_filter
(
'the_content_feed'
,
'wp_staticize_emoji'
);
remove_filter
(
'comment_text_rss'
,
'wp_staticize_emoji'
);
remove_filter
(
'wp_mail'
,
'wp_staticize_emoji_for_email'
);
remove_action
(
'wp_head'
,
'wp_generator'
);
remove_action
(
'wp_head'
,
'wlwmanifest_link'
);
remove_action
(
'wp_head'
,
'rsd_link'
);
remove_action
(
'wp_head'
,
'wp_shortlink_wp_head'
);
}
/* ログイン中にwpadminbar を表示
/*---------------------------------------------------------*/
add_filter
(
'show_admin_bar'
,
'fc_hidden_admin_bar'
);
function
fc_hidden_admin_bar
()
{
return
false
;
}
add_action
(
'admin_head'
,
'fc_hiden_aiosp_custom_link_wrapper'
);
function
fc_hiden_aiosp_custom_link_wrapper
()
{
echo
'<style>
#aiosp_custom_link_wrapper {
display: none !important;
}
</style>'
;
}
add_filter
(
'aioseop_canonical_url'
,
'fc_custom_aioseop_canonical_url'
);
function
fc_custom_aioseop_canonical_url
(
$url
)
{
if
(
is_page
()
||
is_single
())
{
return
get_permalink
();
}
return
$url
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment