WP PLUGIN アーカイブページの投稿表示順設定
・タクソノミーの1ページ表示数をタクソノミー毎のなるよう修正 ・タクソノミーの1ページ表示数変更に合わせてJSを修正 ・タクソノミーの1ページ表示数変更に合わせてテンプレートファイル分割 ・バグ修正:タームIDが無い存在しない場合にpre_get_postでセットしないよう修正 ・バグ修正:通常と検索のpre_get_postでメタキー指定が漏れていたので追加 ・バグ修正:カスタムタクソノミーのpre_get_postでメタキー指定が異なっていたので修正
This commit is contained in:
+3
-197
@@ -1,17 +1,8 @@
|
||||
<?php
|
||||
$all_categories = APOP_UI::get_all_taxonomies( 'category' );
|
||||
$all_tags = APOP_UI::get_all_taxonomies( 'post_tag' );
|
||||
$all_tax = APOP_UI::get_all_taxonomies( 'taxonomy' );
|
||||
?>
|
||||
|
||||
<div class="post-setting-box">
|
||||
<form action="" method="post">
|
||||
<?php
|
||||
wp_nonce_field( 'sh_options' );
|
||||
$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' );
|
||||
$default_per_page = get_option( 'posts_per_page' );
|
||||
?>
|
||||
<h2>設定</h2>
|
||||
@@ -47,194 +38,9 @@ $all_tax = APOP_UI::get_all_taxonomies( 'taxonomy' );
|
||||
</dl>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ( count( $all_categories ) > 0 ): $disp = false; ?>
|
||||
<tr>
|
||||
<th scope="row">カテゴリー設定</th>
|
||||
<td>
|
||||
<dl class="apop_setting_list">
|
||||
<dt>対象</dt>
|
||||
<dd>
|
||||
<ul class="order_setting_list">
|
||||
<?php foreach ( $all_categories as $category ): ?>
|
||||
<?php
|
||||
$check_slug = $opt_cat['target_cat'][ $category->term_id ] ?? '';
|
||||
APOP_UI::is_disp_per_page( $disp, $check_slug );
|
||||
?>
|
||||
<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 checked( $check_slug, 1 ); ?>
|
||||
value="1">
|
||||
<?php echo $category->name; ?>
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt<?php echo APOP_UI::create_disp_class( $disp ); ?>>1ページ表示件数</dt>
|
||||
<dd<?php echo APOP_UI::create_disp_class( $disp ); ?>>
|
||||
<?php $per_page_data = APOP_UI::create_cat_per_page( $opt_per_page, 'category' ); ?>
|
||||
<ul>
|
||||
<li>
|
||||
<label>
|
||||
<input class="per_page_cat" type="radio" name="_apop_per_page[category]"
|
||||
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[category]"
|
||||
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[category]"
|
||||
value="-1"<?php checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
|
||||
</li>
|
||||
<li>
|
||||
<label><input class="per_page_cat" type="radio"
|
||||
name="_apop_per_page[category]"
|
||||
value=""<?php echo $per_page_data['_checked']; ?>>表示数設定
|
||||
<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>
|
||||
</dl>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php if ( count( $all_tags ) > 0 ): $disp = false; ?>
|
||||
<tr>
|
||||
<th scope="row">タグ設定</th>
|
||||
<td>
|
||||
<dl class="apop_setting_list">
|
||||
<dt>対象</dt>
|
||||
<dd>
|
||||
<ul class="order_setting_list">
|
||||
<?php foreach ( $all_tags as $tag ): ?>
|
||||
<?php
|
||||
$check_slug = $opt_tag['target_cat'][ $tag->term_id ] ?? '';
|
||||
APOP_UI::is_disp_per_page( $disp, $check_slug );
|
||||
?>
|
||||
<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 checked( $check_slug, 1 ); ?>
|
||||
value="1">
|
||||
<?php echo $tag->name; ?>
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt<?php echo APOP_UI::create_disp_class( $disp ); ?>>1ページ表示件数</dt>
|
||||
<dd<?php echo APOP_UI::create_disp_class( $disp ); ?>><?php $per_page_data = APOP_UI::create_cat_per_page( $opt_per_page, 'tag' ); ?>
|
||||
<ul>
|
||||
<li>
|
||||
<label>
|
||||
<input class="per_page_tag" type="radio" name="_apop_per_page[tag]"
|
||||
value="default"<?php checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う(<?php echo $default_per_page; ?>
|
||||
件)</label>
|
||||
</li>
|
||||
<li><label>
|
||||
<input class="per_page_tag" type="radio" name="_apop_per_page[tag]"
|
||||
value="all"<?php checked( $per_page_data['_per_page'], 'all' ); ?>>全体設定に従う</label>
|
||||
</li>
|
||||
<li><label>
|
||||
<input class="per_page_tag" type="radio" name="_apop_per_page[tag]"
|
||||
value="-1"<?php checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
|
||||
</li>
|
||||
<li>
|
||||
<label><input class="per_page_tag" type="radio" name="_apop_per_page[tag]"
|
||||
value=""<?php echo $per_page_data['_checked']; ?>>表示数設定
|
||||
<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>
|
||||
</dl>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
if ( count( $all_tax ) > 0 ): $disp = false; ?>
|
||||
<tr>
|
||||
<th scope="row">カスタム分類</th>
|
||||
<td>
|
||||
<dl class="apop_setting_list">
|
||||
<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 ] ?? '';
|
||||
APOP_UI::is_disp_per_page( $disp, $check_slug );
|
||||
?>
|
||||
<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 checked( $check_slug, 1 ); ?>
|
||||
value="1">
|
||||
<?php echo $tax->name; ?>
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt<?php echo APOP_UI::create_disp_class( $disp ); ?>>1ページ表示件数</dt>
|
||||
<dd<?php echo APOP_UI::create_disp_class( $disp ); ?>>
|
||||
<?php $per_page_data = APOP_UI::create_cat_per_page( $opt_per_page, 'tax' ); ?>
|
||||
<ul>
|
||||
<li>
|
||||
<label>
|
||||
<input class="per_page_tax" type="radio" name="_apop_per_page[tax]"
|
||||
value="default"<?php checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う(<?php echo $default_per_page; ?>
|
||||
件)</label>
|
||||
</li>
|
||||
<li><label>
|
||||
<input class="per_page_tax" type="radio" name="_apop_per_page[tax]"
|
||||
value="all"<?php checked( $per_page_data['_per_page'], 'all' ); ?>>全体設定に従う</label>
|
||||
</li>
|
||||
<li><label>
|
||||
<input class="per_page_tax" type="radio" name="_apop_per_page[tax]"
|
||||
value="-1"<?php checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
|
||||
</li>
|
||||
<li>
|
||||
<label><input class="per_page_tax" type="radio" name="_apop_per_page[tax]"
|
||||
value=""<?php echo $per_page_data['_checked']; ?>>表示数設定
|
||||
<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>
|
||||
</dl>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php APOP_UI::disp_tax_setting( 'category', 'カテゴリー', '_apop_cat_order' ); ?>
|
||||
<?php APOP_UI::disp_tax_setting( 'post_tag', 'タグ', '_apop_tag_order' ); ?>
|
||||
<?php APOP_UI::disp_tax_setting( 'taxonomy', 'カスタム分類', '_apop_tax_order' ); ?>
|
||||
</table>
|
||||
<p class="submit"><input type="submit" name="Submit" class="button-primary" value="変更を保存"/>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user