WP PLUGIN アーカイブ毎に投稿表示順を設定する
・ファイル名、クラス名の変更 ・タクソノミーの有効化で、カテゴリー、タグ、カスタム分類のメタキーを分割 ・表示用クラスの追加 ・readmeの追加等
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?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>
|
||||
+89
-22
@@ -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>
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
$opt = get_option( 'post_cat_order' );
|
||||
$category_list = post_sort_cat_order::get_category_list( $opt );
|
||||
?>
|
||||
<div class="post-order-box">
|
||||
<form action="" method="post">
|
||||
<?php wp_nonce_field( 'sh_options' ); ?>
|
||||
<h2>投稿表示順設定</h2>
|
||||
<div class="list-orders-outer">
|
||||
<?php if ( count( $category_list ) == 0 ): ?>
|
||||
<p>対象カテゴリーを選択してください。[ <a href="./admin.php?page=nb_post_sort_setting">カテゴリー選択</a> ]</p>
|
||||
<?php else: ?>
|
||||
<?php foreach ( $category_list as $category ): ?>
|
||||
<div class="list-orders-inner">
|
||||
<h3><?php echo $category->name; ?></h3>
|
||||
<?php $target_posts = post_sort_cat_order::get_sort_post_list( $category->term_id ); ?>
|
||||
<ul class="post-order-list">
|
||||
<?php foreach ( $target_posts as $key => $target_post ): $sort_num = $key + 1; ?>
|
||||
<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="nb_post_cat[post_sort][<?php echo $category->term_id; ?>][<?php echo $target_post->ID; ?>]"
|
||||
value="<?php echo $sort_num; ?>">
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<p class="submit"><input type="submit" name="Submit" class="button-primary" value="変更を保存"/></p>
|
||||
</form>
|
||||
</div>
|
||||
Reference in New Issue
Block a user