WP PLUGIN アーカイブ毎に投稿表示順を設定する

・ファイル名、クラス名の変更
・タクソノミーの有効化で、カテゴリー、タグ、カスタム分類のメタキーを分割
・表示用クラスの追加
・readmeの追加等
This commit is contained in:
2021-05-04 15:57:30 +09:00
parent 2ed2b25194
commit 7722f53f10
12 changed files with 409 additions and 211 deletions
+89 -22
View File
@@ -1,33 +1,100 @@
<?php
//各種パラメータ
$all_categories = get_categories();
$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-order-box">
<form action="" method="post">
<?php
wp_nonce_field( 'sh_options' );
$opt = get_option( 'post_cat_order' );
$opt_cat = get_option( '_apop_cat_order' );
$opt_tag = get_option( '_apop_tag_order' );
$opt_tax = get_option( '_apop_tax_order' );
?>
<h2>対象カテゴリー選択</h2>
<ul class="order_setting_list">
<?php foreach ( $all_categories as $category ): ?>
<li>
<div class="select_cat">
<label>
<input type="hidden"
name="post_cat_order[target_cat][<?php echo $category->slug; ?>]"
value="0">
<input type="checkbox"
name="post_cat_order[target_cat][<?php echo $category->slug; ?>]"
<?php echo checked( $opt['target_cat'][ $category->slug ], 1 ); ?>
value="1">
<?php echo $category->name; ?>
</label>
</div>
</li>
<?php endforeach; ?>
</ul>
<h2>対象タクソノミー選択</h2>
<table>
<?php if ( count( $all_categories ) > 0 ): ?>
<tr>
<th>カテゴリー</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>タグ</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>カスタム分類</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>