Files
POST_ORDER_BY_ARCHIVE/template/order.php
T
nobu 7722f53f10 WP PLUGIN アーカイブ毎に投稿表示順を設定する
・ファイル名、クラス名の変更
・タクソノミーの有効化で、カテゴリー、タグ、カスタム分類のメタキーを分割
・表示用クラスの追加
・readmeの追加等
2021-05-04 16:19:14 +09:00

53 lines
3.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
$order_list = array(
'category' => APOP_UI::get_cat_tag_list( 'cat', 'category' ),
'tag_id' => APOP_UI::get_cat_tag_list( 'tag', 'post_tag' ),
);
?>
<div class="post-order-box">
<form action="" method="post">
<?php wp_nonce_field( 'sh_options' ); ?>
<?php foreach ( $order_list as $tax_key => $tax_list ) : ?>
<div class="list-orders-outer">
<?php if ( count( $tax_list ) == 0 ): ?>
<p>対象<?php echo APOP_UI::get_tax_name($tax_key); ?>を選択してください。
<a href="./admin.php?page=apop_post_sort_setting"><?php echo APOP_UI::get_tax_name($tax_key); ?>選択</a>
</p>
<?php else: $exclude_posts = []; ?>
<?php foreach ( $tax_list as $tax_data ): ?>
<div class="list-orders-inner">
<h3><?php echo $tax_data->name; ?></h3>
<?php $target_posts = APOP_UI::get_sort_post_list( $tax_data->term_id, $tax_key, $tax_data->taxonomy ); ?>
<ul class="post-order-list">
<?php foreach ( $target_posts as $key => $target_post ): $sort_num = $key + 1;
$exclude_posts[] = $target_post->ID; ?>
<li class="product-list">
<span class="sort-num-label"><?php echo $sort_num; ?></span>
<?php echo get_the_title( $target_post->ID ); ?>
<input type="hidden" class="list_order"
name="_apop_post_<?php echo $tax_data->taxonomy; ?>[post_sort][<?php echo $tax_data->term_id; ?>][<?php echo $target_post->ID; ?>]"
value="<?php echo $sort_num; ?>">
</li>
<?php endforeach; ?>
<?php $target_posts_no_order = APOP_UI::get_none_sort_post_list( $tax_data->term_id, $tax_key, $exclude_posts ); ?>
<?php if ( count( $target_posts_no_order ) > 0 ): ?>
<?php $sort_num = $sort_num ?? 0; ?>
<?php foreach ( $target_posts_no_order as $key => $target_post_no_order ): $sort_num_no_order = $sort_num + $key + 1; ?>
<li class="product-list">
<span class="sort-num-label"><?php echo $sort_num_no_order; ?></span>
<?php echo get_the_title( $target_post_no_order->ID ); ?>
<input type="hidden" class="list_order"
name="_apop_post_<?php echo $tax_data->taxonomy; ?>[post_sort][<?php echo $tax_data->term_id; ?>][<?php echo $target_post_no_order->ID; ?>]"
value="<?php echo $sort_num_no_order; ?>">
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
<?php endforeach; ?>
<p class="submit"><input type="submit" name="Submit" class="button-primary" value="変更を保存"/></p>
</form>
</div>