WP PLUGIN アーカイブページの投稿表示順設定
・不要な初期化を削除 ・カスタムタクソノミー対応 ・設定画面のタブ化 ・設定画面各タクソノミーの投稿リスト表示をメソッド化 ・name属性の閉じ忘れ修正 ・不要なreturn削除 ・APOP_UI::create_product_none_order_list() returnに変数が未設定の場合の条件を追加 ・readmeに若干加筆
This commit is contained in:
+83
-42
@@ -1,53 +1,94 @@
|
||||
<?php
|
||||
$order_list = array(
|
||||
'category' => APOP_UI::get_cat_tag_list( 'cat', 'category' ),
|
||||
'tag_id' => APOP_UI::get_cat_tag_list( 'tag', 'post_tag' ),
|
||||
);
|
||||
$category_lists = array( 'category' => APOP_UI::get_cat_tag_list( 'cat', 'category' ) );
|
||||
$tag_lists = array( 'tag_id' => APOP_UI::get_cat_tag_list( 'tag', 'post_tag' ) );
|
||||
$taxonomy_lists = array( 'taxonomy' => APOP_UI::get_cat_tag_list( 'tax', 'taxonomy' ) );
|
||||
?>
|
||||
<div class="post-order-box">
|
||||
<form action="" method="post">
|
||||
<?php wp_nonce_field( 'sh_options' ); ?>
|
||||
<?php foreach ( $order_list as $tax_key => $tax_list ) : ?>
|
||||
<nav class="post-order-nav">
|
||||
<ul>
|
||||
<li class="en">カテゴリー</li>
|
||||
<li>タグ</li>
|
||||
<li>カスタム分類</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="post-order-box-outer">
|
||||
<div class="post-order-box">
|
||||
<h2>カテゴリー</h2>
|
||||
<?php foreach ( $category_lists 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 if ( count( $tax_list ) > 0 ): $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>
|
||||
<form action="" method="post">
|
||||
<?php wp_nonce_field( 'sh_options' ); ?>
|
||||
<h3><?php echo $tax_data->name; ?></h3>
|
||||
<ul class="post-order-list">
|
||||
<?php
|
||||
list( $product_order_list, $exclude_posts, $sort_num ) = APOP_UI::create_order_list( $tax_data, $tax_key, $exclude_posts );
|
||||
echo $product_order_list;
|
||||
echo APOP_UI::create_product_none_order_list( $tax_data, $tax_key, $exclude_posts, $sort_num );
|
||||
?>
|
||||
</ul>
|
||||
<p class="submit post-order"><input type="submit" name="Submit" class="button-primary"
|
||||
value="変更を保存"/></p>
|
||||
</form>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<p class="submit"><input type="submit" name="Submit" class="button-primary" value="変更を保存"/></p>
|
||||
</form>
|
||||
</div>
|
||||
<div class="post-order-box">
|
||||
<h2>タグ</h2>
|
||||
<?php foreach ( $tag_lists as $tax_key => $tax_list ) : ?>
|
||||
<div class="list-orders-outer">
|
||||
<?php if ( count( $tax_list ) > 0 ): $exclude_posts = []; ?>
|
||||
<?php foreach ( $tax_list as $tax_data ): ?>
|
||||
<div class="list-orders-inner">
|
||||
<form action="" method="post">
|
||||
<?php wp_nonce_field( 'sh_options' ); ?>
|
||||
<h3><?php echo $tax_data->name; ?></h3>
|
||||
<ul class="post-order-list">
|
||||
<?php
|
||||
list( $product_order_list, $exclude_posts, $sort_num ) = APOP_UI::create_order_list( $tax_data, $tax_key, $exclude_posts );
|
||||
echo $product_order_list;
|
||||
echo APOP_UI::create_product_none_order_list( $tax_data, $tax_key, $exclude_posts, $sort_num );
|
||||
?>
|
||||
</ul>
|
||||
<p class="submit post-order"><input type="submit" name="Submit" class="button-primary"
|
||||
value="変更を保存"/></p>
|
||||
</form>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div class="post-order-box">
|
||||
<h2>カスタム分類</h2>
|
||||
<?php foreach ( $taxonomy_lists as $tax_key => $taxonomy_list ): ?>
|
||||
<div class="list-orders-outer">
|
||||
<?php foreach ( $taxonomy_list as $tax_list ) : ?>
|
||||
<?php if ( count( $taxonomy_list ) > 0 ): $exclude_posts = []; ?>
|
||||
<?php foreach ( $tax_list as $tax_data ): ?>
|
||||
<div class="list-orders-inner">
|
||||
<form action="" method="post">
|
||||
<?php wp_nonce_field( 'sh_options' ); ?>
|
||||
<h3><?php echo $tax_data->name; ?></h3>
|
||||
<ul class="post-order-list">
|
||||
<?php
|
||||
list( $product_order_list, $exclude_posts, $sort_num ) = APOP_UI::create_order_list( $tax_data, $tax_key, $exclude_posts );
|
||||
echo $product_order_list;
|
||||
echo APOP_UI::create_product_none_order_list( $tax_data, $tax_key, $exclude_posts, $sort_num );
|
||||
?>
|
||||
</ul>
|
||||
<p class="submit post-order"><input type="submit" name="Submit" class="button-primary"
|
||||
value="変更を保存"/></p>
|
||||
</form>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -4,7 +4,7 @@ $all_tags = APOP_UI::get_all_taxonomies( 'post_tag' );
|
||||
$all_tax = APOP_UI::get_all_taxonomies( 'taxonomy' );
|
||||
?>
|
||||
|
||||
<div class="post-order-box">
|
||||
<div class="post-setting-box">
|
||||
<form action="" method="post">
|
||||
<?php
|
||||
wp_nonce_field( 'sh_options' );
|
||||
@@ -13,10 +13,10 @@ $all_tax = APOP_UI::get_all_taxonomies( 'taxonomy' );
|
||||
$opt_tax = get_option( '_apop_tax_order' );
|
||||
?>
|
||||
<h2>対象タクソノミー選択</h2>
|
||||
<table>
|
||||
<table class="form-table">
|
||||
<?php if ( count( $all_categories ) > 0 ): ?>
|
||||
<tr>
|
||||
<th>カテゴリー</th>
|
||||
<th scope="row">カテゴリー</th>
|
||||
<td>
|
||||
<ul class="order_setting_list">
|
||||
<?php foreach ( $all_categories as $category ): ?>
|
||||
@@ -42,7 +42,7 @@ $all_tax = APOP_UI::get_all_taxonomies( 'taxonomy' );
|
||||
<?php endif; ?>
|
||||
<?php if ( count( $all_tags ) > 0 ): ?>
|
||||
<tr>
|
||||
<th>タグ</th>
|
||||
<th scope="row">タグ</th>
|
||||
<td>
|
||||
<ul class="order_setting_list">
|
||||
<?php foreach ( $all_tags as $tag ): ?>
|
||||
@@ -68,7 +68,7 @@ $all_tax = APOP_UI::get_all_taxonomies( 'taxonomy' );
|
||||
<?php endif; ?>
|
||||
<?php if ( count( $all_tax ) > 0 ): ?>
|
||||
<tr>
|
||||
<th>カスタム分類</th>
|
||||
<th scope="row">カスタム分類</th>
|
||||
<td>
|
||||
<ul class="order_setting_list">
|
||||
<?php foreach ( $all_tax as $tax ): $all_taxs = APOP_UI::get_all_taxonomies( $tax ) ?>
|
||||
|
||||
Reference in New Issue
Block a user