Written by Anonymous
if ( !function_exists( 'generate_page_display_check_list' ) ):
function generate_page_display_check_list( $name, $checks, $width = 0 ) {
$width = ($width == 0) ? 'auto' : $width . 'px';
$checks = (array) $checks;
// 基本のチェック項目
$page_types = array(
'is_front_page' => __( 'フロントページのみ', THEME_NAME ),
'is_single' => __( '投稿', THEME_NAME ),
'is_page' => __( '固定ページ', THEME_NAME ),
'is_category' => __( 'カテゴリー一覧', THEME_NAME ),
'is_tag' => __( 'タグ一覧', THEME_NAME ),
'is_author' => __( '著者一覧', THEME_NAME ),
'is_archive' => __( 'アーカイブ一覧', THEME_NAME ),
'is_search' => __( '検索結果一覧', THEME_NAME ),
'is_404' => __( '404ページ', THEME_NAME ),
);
// 条件付きのチェック項目を動的に追加
if ( function_exists('is_amp_enable') && is_amp_enable() ) {
$page_types['is_amp'] = __( 'AMPページ', THEME_NAME );
}
if ( function_exists('is_wpforo_exist') && is_wpforo_exist() ) {
$page_types['is_wpforo_plugin_page'] = __( 'wpForoページ', THEME_NAME );
}
if ( function_exists('is_bbpress_exist') && is_bbpress_exist() ) {
$page_types['is_bbpress_page'] = __( 'bbPressページ', THEME_NAME );
}
if ( function_exists('is_buddypress_exist') && is_buddypress_exist() ) {
$page_types['is_buddypress_page'] = __( 'BuddyPressページ', THEME_NAME );
}
if ( function_exists('is_plugin_fourm_exist') && is_plugin_fourm_exist() ) {
$page_types['is_plugin_fourm_page'] = __( 'プラグインフォーラムページ(bbPress、BuddyPress、wpForo)', THEME_NAME );
}
echo '<div class="tab-content page-display-check-list ' . esc_attr($name) . '-list" style="width:' . esc_attr($width) . ';">';
echo '<ul>';
foreach ( $page_types as $value => $label ) {
$id = $name . '_' . $value;
echo '<li>';
echo '<input type="checkbox" name="' . esc_attr($name) . '[]" value="' . esc_attr($value) . '" id="' . esc_attr($id) . '" ';
checked( in_array( $value, $checks, true ) );
echo '><label for="' . esc_attr($id) . '">' . esc_html($label) . '</label>';
echo '</li>';
}
echo '</ul></div>';
}
endif;