WP PLUGIN アーカイブページの投稿表示順設定

・タクソノミーの1ページ表示数をタクソノミー毎のなるよう修正
・タクソノミーの1ページ表示数変更に合わせてJSを修正
・タクソノミーの1ページ表示数変更に合わせてテンプレートファイル分割
・バグ修正:タームIDが無い存在しない場合にpre_get_postでセットしないよう修正
・バグ修正:通常と検索のpre_get_postでメタキー指定が漏れていたので追加
・バグ修正:カスタムタクソノミーのpre_get_postでメタキー指定が異なっていたので修正
This commit is contained in:
2021-05-09 18:11:10 +09:00
parent df9c7deef1
commit 59e11dbb14
8 changed files with 205 additions and 263 deletions
+65
View File
@@ -0,0 +1,65 @@
<?php if ( isset( $tax_data, $order_name, $order_tax ) ): ?>
<?php
$default_per_page = get_option( 'posts_per_page' );
$opt_per_page = get_option( '_apop_per_page' );
?>
<dl class="apop_setting_list">
<dt>対象</dt>
<dd>
<ul class="order_setting_list">
<?php foreach ( $tax_data as $tax_datum ): ?>
<?php
$opt_cat = get_option( $order_name );
$check_slug = $opt_cat['target_cat'][ $tax_datum->term_id ] ?? '';
APOP_UI::is_disp_per_page( $disp, $check_slug );
?>
<li>
<div class="select_cat">
<label>
<input type="hidden"
name="<?php echo $order_name; ?>[target_cat][<?php echo $tax_datum->term_id; ?>]"
value="0">
<input class="select_cat_checkbox" type="checkbox"
name="<?php echo $order_name; ?>[target_cat][<?php echo $tax_datum->term_id; ?>]"
<?php checked( $check_slug, 1 ); ?>
value="1">
<?php echo $tax_datum->name; ?>
</label>
</div>
<?php $per_page_data = APOP_UI::create_tax_per_page( $opt_per_page, $order_tax, $tax_datum->term_id ); ?>
<div class="select_per_page">
<ul>
<li>
<label>
<input class="per_page_cat" type="radio"
name="_apop_per_page[<?php echo $order_tax; ?>][<?php echo $tax_datum->term_id; ?>]"
value="default"<?php checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う(<?php echo $default_per_page; ?>
件)</label>
</li>
<li><label>
<input class="per_page_cat" type="radio"
name="_apop_per_page[<?php echo $order_tax; ?>][<?php echo $tax_datum->term_id; ?>]"
value="all"<?php checked( $per_page_data['_per_page'], 'all' ); ?>>全体設定に従う</label>
</li>
<li><label>
<input class="per_page_cat" type="radio"
name="_apop_per_page[<?php echo $order_tax; ?>][<?php echo $tax_datum->term_id; ?>]"
value="-1"<?php checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
</li>
<li class="set_number_list">
<label><input class="per_page_cat set_number" type="radio"
name="_apop_per_page[<?php echo $order_tax; ?>][<?php echo $tax_datum->term_id; ?>]"
value=""<?php echo $per_page_data['_checked']; ?>>表示数設定
<input class="per_page_cat_input" type="text"
name="_apop_per_page[<?php echo $order_tax; ?>][<?php echo $tax_datum->term_id; ?>]"
value="<?php echo $per_page_data['_per_page_num']; ?>" required>
</label>
</li>
</ul>
</div>
</li>
<?php endforeach; ?>
</ul>
</dd>
</dl>
<?php endif;