WP PLUGIN アーカイブページの投稿表示順設定
・管理画面メニュー(サブメニュー)の修正 ・1ページ表示件数の追加 ・pre_get_postするクエリの追加 ・検索用設定の追加
This commit is contained in:
+170
-59
@@ -8,35 +8,92 @@ $all_tax = APOP_UI::get_all_taxonomies( 'taxonomy' );
|
||||
<form action="" method="post">
|
||||
<?php
|
||||
wp_nonce_field( 'sh_options' );
|
||||
$opt_cat = get_option( '_apop_cat_order' );
|
||||
$opt_tag = get_option( '_apop_tag_order' );
|
||||
$opt_tax = get_option( '_apop_tax_order' );
|
||||
$opt_cat = get_option( '_apop_cat_order' );
|
||||
$opt_per_page = get_option( '_apop_per_page' );
|
||||
$opt_tag = get_option( '_apop_tag_order' );
|
||||
$opt_tax = get_option( '_apop_tax_order' );
|
||||
?>
|
||||
<h2>対象タクソノミー選択</h2>
|
||||
<h2>設定</h2>
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row">検索</th>
|
||||
<td>
|
||||
<dl class="post_per_page_list">
|
||||
<dt>1ページ表示件数</dt>
|
||||
<dd><?php $per_page_data = APOP_UI::create_cat_per_page( $opt_per_page, 'search' ); ?>
|
||||
<ul>
|
||||
<li>
|
||||
<label>
|
||||
<input class="per_page_search" type="radio" name="_apop_per_page[search]"
|
||||
value="default"<?php echo checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う</label>
|
||||
</li>
|
||||
<li><label>
|
||||
<input class="per_page_search" type="radio" name="_apop_per_page[search]"
|
||||
value="-1"<?php echo checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
|
||||
</li>
|
||||
<li>
|
||||
<label><input class="per_page_search" type="radio"
|
||||
name="_apop_per_page[search]"
|
||||
value="set"<?php echo $per_page_data['_set']; ?>>表示数設定
|
||||
<input class="per_page_search_input" type="text"
|
||||
name="_apop_per_page[search]"
|
||||
value="<?php echo $per_page_data['_per_page_num']; ?>" required>
|
||||
</label></li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ( count( $all_categories ) > 0 ): ?>
|
||||
<tr>
|
||||
<th scope="row">カテゴリー</th>
|
||||
<td>
|
||||
<ul class="order_setting_list">
|
||||
<?php foreach ( $all_categories as $category ): ?>
|
||||
<?php $check_slug = $opt_cat['target_cat'][ $category->term_id ] ?? ''; ?>
|
||||
<li>
|
||||
<div class="select_cat">
|
||||
<dl class="post_per_page_list">
|
||||
<dt>1ページ表示件数</dt>
|
||||
<dd><?php $per_page_data = APOP_UI::create_cat_per_page( $opt_per_page, 'category' ); ?>
|
||||
<ul>
|
||||
<li>
|
||||
<label>
|
||||
<input type="hidden"
|
||||
name="_apop_cat_order[target_cat][<?php echo $category->term_id; ?>]"
|
||||
value="0">
|
||||
<input type="checkbox"
|
||||
name="_apop_cat_order[target_cat][<?php echo $category->term_id; ?>]"
|
||||
<?php echo checked( $check_slug, 1 ); ?>
|
||||
value="1">
|
||||
<?php echo $category->name; ?>
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<input class="per_page_cat" type="radio" name="_apop_per_page[category]"
|
||||
value="default"<?php echo checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う</label>
|
||||
</li>
|
||||
<li><label>
|
||||
<input class="per_page_cat" type="radio" name="_apop_per_page[category]"
|
||||
value="-1"<?php echo checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
|
||||
</li>
|
||||
<li>
|
||||
<label><input class="per_page_cat" type="radio"
|
||||
name="_apop_per_page[category]"
|
||||
value="set"<?php echo $per_page_data['_set']; ?>>表示数設定
|
||||
<input class="per_page_cat_input" type="text"
|
||||
name="_apop_per_page[category]"
|
||||
value="<?php echo $per_page_data['_per_page_num']; ?>" required>
|
||||
</label></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt>対象カテゴリー</dt>
|
||||
<dd>
|
||||
<ul class="order_setting_list">
|
||||
<?php foreach ( $all_categories as $category ): ?>
|
||||
<?php $check_slug = $opt_cat['target_cat'][ $category->term_id ] ?? ''; ?>
|
||||
<li>
|
||||
<div class="select_cat">
|
||||
<label>
|
||||
<input type="hidden"
|
||||
name="_apop_cat_order[target_cat][<?php echo $category->term_id; ?>]"
|
||||
value="0">
|
||||
<input type="checkbox"
|
||||
name="_apop_cat_order[target_cat][<?php echo $category->term_id; ?>]"
|
||||
<?php echo checked( $check_slug, 1 ); ?>
|
||||
value="1">
|
||||
<?php echo $category->name; ?>
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
@@ -44,25 +101,52 @@ $all_tax = APOP_UI::get_all_taxonomies( 'taxonomy' );
|
||||
<tr>
|
||||
<th scope="row">タグ</th>
|
||||
<td>
|
||||
<ul class="order_setting_list">
|
||||
<?php foreach ( $all_tags as $tag ): ?>
|
||||
<?php $check_slug = $opt_tag['target_cat'][ $tag->term_id ] ?? ''; ?>
|
||||
<li>
|
||||
<div class="select_cat">
|
||||
<dl class="post_per_page_list">
|
||||
<dt>1ページ表示件数</dt>
|
||||
<dd><?php $per_page_data = APOP_UI::create_cat_per_page( $opt_per_page, 'tag' ); ?>
|
||||
<ul>
|
||||
<li>
|
||||
<label>
|
||||
<input type="hidden"
|
||||
name="_apop_tag_order[target_cat][<?php echo $tag->term_id; ?>]"
|
||||
value="0">
|
||||
<input type="checkbox"
|
||||
name="_apop_tag_order[target_cat][<?php echo $tag->term_id; ?>]"
|
||||
<?php echo checked( $check_slug, 1 ); ?>
|
||||
value="1">
|
||||
<?php echo $tag->name; ?>
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<input class="per_page_tag" type="radio" name="_apop_per_page[tag]"
|
||||
value="default"<?php echo checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う</label>
|
||||
</li>
|
||||
<li><label>
|
||||
<input class="per_page_tag" type="radio" name="_apop_per_page[tag]"
|
||||
value="-1"<?php echo checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
|
||||
</li>
|
||||
<li>
|
||||
<label><input class="per_page_tag" type="radio" name="_apop_per_page[tag]"
|
||||
value="set"<?php echo $per_page_data['_set']; ?>>表示数設定
|
||||
<input class="per_page_tag_input" type="text"
|
||||
name="_apop_per_page[tag]"
|
||||
value="<?php echo $per_page_data['_per_page_num']; ?>" required>
|
||||
</label></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt>対象タグ</dt>
|
||||
<dd>
|
||||
<ul class="order_setting_list">
|
||||
<?php foreach ( $all_tags as $tag ): ?>
|
||||
<?php $check_slug = $opt_tag['target_cat'][ $tag->term_id ] ?? ''; ?>
|
||||
<li>
|
||||
<div class="select_cat">
|
||||
<label>
|
||||
<input type="hidden"
|
||||
name="_apop_tag_order[target_cat][<?php echo $tag->term_id; ?>]"
|
||||
value="0">
|
||||
<input type="checkbox"
|
||||
name="_apop_tag_order[target_cat][<?php echo $tag->term_id; ?>]"
|
||||
<?php echo checked( $check_slug, 1 ); ?>
|
||||
value="1">
|
||||
<?php echo $tag->name; ?>
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
@@ -70,27 +154,54 @@ $all_tax = APOP_UI::get_all_taxonomies( 'taxonomy' );
|
||||
<tr>
|
||||
<th scope="row">カスタム分類</th>
|
||||
<td>
|
||||
<ul class="order_setting_list">
|
||||
<?php foreach ( $all_tax as $tax ): $all_taxs = APOP_UI::get_all_taxonomies( $tax ) ?>
|
||||
<?php foreach ( $all_taxs as $tax ): ?>
|
||||
<?php $check_slug = $opt_tax['target_cat'][ $tax->term_id ] ?? ''; ?>
|
||||
<dl class="post_per_page_list">
|
||||
<dt>1ページ表示件数</dt>
|
||||
<dd>
|
||||
<?php $per_page_data = APOP_UI::create_cat_per_page( $opt_per_page, 'tax' ); ?>
|
||||
<ul>
|
||||
<li>
|
||||
<div class="select_cat">
|
||||
<label>
|
||||
<input type="hidden"
|
||||
name="_apop_tax_order[target_cat][<?php echo $tax->term_id; ?>]"
|
||||
value="0">
|
||||
<input type="checkbox"
|
||||
name="_apop_tax_order[target_cat][<?php echo $tax->term_id; ?>]"
|
||||
<?php echo checked( $check_slug, 1 ); ?>
|
||||
value="1">
|
||||
<?php echo $tax->name; ?>
|
||||
</label>
|
||||
</div>
|
||||
<label>
|
||||
<input class="per_page_tax" type="radio" name="_apop_per_page[tax]"
|
||||
value="default"<?php echo checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う</label>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<li><label>
|
||||
<input class="per_page_tax" type="radio" name="_apop_per_page[tax]"
|
||||
value="-1"<?php echo checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
|
||||
</li>
|
||||
<li>
|
||||
<label><input class="per_page_tax" type="radio" name="_apop_per_page[tax]"
|
||||
value="set"<?php echo $per_page_data['_set']; ?>>表示数設定
|
||||
<input class="per_page_tax_input" type="text"
|
||||
name="_apop_per_page[tax]"
|
||||
value="<?php echo $per_page_data['_per_page_num']; ?>" required>
|
||||
</label></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt>対象タクソノミー</dt>
|
||||
<dd>
|
||||
<ul class="order_setting_list">
|
||||
<?php foreach ( $all_tax as $tax ): $all_taxs = APOP_UI::get_all_taxonomies( $tax ) ?>
|
||||
<?php foreach ( $all_taxs as $tax ): ?>
|
||||
<?php $check_slug = $opt_tax['target_cat'][ $tax->term_id ] ?? ''; ?>
|
||||
<li>
|
||||
<div class="select_cat">
|
||||
<label>
|
||||
<input type="hidden"
|
||||
name="_apop_tax_order[target_cat][<?php echo $tax->term_id; ?>]"
|
||||
value="0">
|
||||
<input type="checkbox"
|
||||
name="_apop_tax_order[target_cat][<?php echo $tax->term_id; ?>]"
|
||||
<?php echo checked( $check_slug, 1 ); ?>
|
||||
value="1">
|
||||
<?php echo $tax->name; ?>
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
Reference in New Issue
Block a user