Files
POST_ORDER_BY_ARCHIVE/template/setting.php
T
nobu 05b5fa91aa WP PLUGIN アーカイブページの投稿表示順設定
・不要な初期化を削除
・カスタムタクソノミー対応
・設定画面のタブ化
・設定画面各タクソノミーの投稿リスト表示をメソッド化
・name属性の閉じ忘れ修正
・不要なreturn削除
・APOP_UI::create_product_none_order_list() returnに変数が未設定の場合の条件を追加
・readmeに若干加筆
2021-05-05 18:07:14 +09:00

100 lines
4.7 KiB
PHP

<?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_tag = get_option( '_apop_tag_order' );
$opt_tax = get_option( '_apop_tax_order' );
?>
<h2>対象タクソノミー選択</h2>
<table class="form-table">
<?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">
<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>
</td>
</tr>
<?php endif; ?>
<?php if ( count( $all_tags ) > 0 ): ?>
<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">
<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>
</td>
</tr>
<?php endif; ?>
<?php if ( count( $all_tax ) > 0 ): ?>
<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 ] ?? ''; ?>
<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>
</td>
</tr>
<?php endif; ?>
</table>
<p class="submit"><input type="submit" name="Submit" class="button-primary" value="変更を保存"/>
</form>
</div>