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

・ベース部分(カテゴリー、投稿)の表示順用カスタムフィールド設定登録の作成
This commit is contained in:
2021-05-03 18:51:02 +09:00
commit 2ed2b25194
15 changed files with 486 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
<?php
//各種パラメータ
$all_categories = get_categories();
?>
<div class="post-order-box">
<form action="" method="post">
<?php
wp_nonce_field( 'sh_options' );
$opt = get_option( 'post_cat_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>
<p class="submit"><input type="submit" name="Submit" class="button-primary" value="変更を保存"/>
</form>
</div>
+34
View File
@@ -0,0 +1,34 @@
<?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>
+3
View File
@@ -0,0 +1,3 @@
<div class="updated fade">
<p><strong>設定を保存しました</strong></p>
</div>