WP PLUGIN ソート対象拡張
・通常、検索、タクソノミーにソート用カスタムフィールドの設定入力欄を追加 ・通常と検索にカスタムフィールド検索処理を実装 ・タクソノミーに通常+カスタムフィールドのメニューを追加 ・タクソノミーに通常+カスタムフィールドとドラッグソートの切り替え用ラジオボタンを追加
This commit is contained in:
+47
-118
@@ -1,12 +1,5 @@
|
||||
<?php
|
||||
$normal_lists = APOP_UI::get_all_search_normal_posts( 'normal' );
|
||||
$search_lists = APOP_UI::get_all_search_normal_posts( 'search' );
|
||||
$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' ) );
|
||||
$submit_type = APOP_UI::input_post_filter( 'submit_type', 'str' );
|
||||
$apop_search_order_check = APOP_UI::get_order_type( '_apop_search_order' );
|
||||
$apop_normal_check = APOP_UI::get_order_type( '_apop_normal_order' );
|
||||
$submit_type = APOP_UI::input_post_filter( 'submit_type', 'str' );
|
||||
?>
|
||||
<div class="post-setting-box">
|
||||
<h2>並べ替え</h2>
|
||||
@@ -22,163 +15,99 @@ $apop_normal_check = APOP_UI::get_order_type( '_apop_normal_order' );
|
||||
<div class="post-order-box-outer" data-submit_type="<?php echo $submit_type; ?>">
|
||||
<div class="post-order-box">
|
||||
<div class="list-orders-outer">
|
||||
<?php $exclude_posts = []; ?>
|
||||
<div class="list-orders-inner search_inner">
|
||||
<div class="list-orders-inner">
|
||||
<form action="" method="post">
|
||||
<h3>通常</h3>
|
||||
<?php wp_nonce_field( 'sh_options' ); ?>
|
||||
<ul class="apop_normal_order_target"
|
||||
data-normal_order_target="<?php echo $apop_normal_check; ?>">
|
||||
<li><label>
|
||||
<input class="apop_normal_order" type="radio" name="_apop_normal_order"
|
||||
value="1"<?php checked( $apop_normal_check, 1 ); ?>>標準</label></li>
|
||||
<li><label>
|
||||
<input class="apop_normal_order" type="radio" name="_apop_normal_order"
|
||||
value="2"<?php checked( $apop_normal_check, 2 ); ?>>ドラッグソート</label></li>
|
||||
</ul>
|
||||
<?php
|
||||
$order_target_type = '_apop_normal_order';
|
||||
$order_target = APOP_UI::get_order_type( $order_target_type );
|
||||
?>
|
||||
<?php include APOP_PLUGIN_PATH . 'template/order_parts_menu.php'; ?>
|
||||
<hr>
|
||||
<div class="normal_sort_box">
|
||||
<?php list( $list, $alert ) = APOP_UI::create_search_normal_list( 'normal' ); ?>
|
||||
<div class="sort_box">
|
||||
<?php list( $list, $alert, $field_metakey_input ) = APOP_UI::create_search_normal_list( 'normal' ); ?>
|
||||
<?php echo $alert; ?>
|
||||
<ul class="post-order-list search_normal_sort">
|
||||
<?php echo $list; ?>
|
||||
</ul>
|
||||
<?php echo $field_metakey_input; ?>
|
||||
</div>
|
||||
|
||||
<div class="normal_sort_box">
|
||||
<div class="sort_box">
|
||||
<?php echo APOP_UI::none_registered_alert_msg(); ?>
|
||||
<ul class="post-order-list">
|
||||
<?php echo APOP_UI::get_all_search_normal_posts( 'normal' ); ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="submit_type" value="0">
|
||||
<p class="submit post-order"><input type="submit" name="Submit" class="button-primary"
|
||||
value="変更を保存"/></p>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-order-box">
|
||||
<div class="list-orders-outer">
|
||||
<?php $exclude_posts = []; ?>
|
||||
<div class="list-orders-inner search_inner">
|
||||
<div class="list-orders-inner">
|
||||
<form action="" method="post">
|
||||
<h3>検索</h3>
|
||||
<?php wp_nonce_field( 'sh_options' ); ?>
|
||||
<ul class="apop_search_order_target"
|
||||
data-search_order_target="<?php echo $apop_search_order_check; ?>">
|
||||
<li><label>
|
||||
<input class="apop_search_order" type="radio" name="_apop_search_order"
|
||||
value="1"<?php checked( $apop_search_order_check, 1 ); ?>>標準</label></li>
|
||||
<li><label>
|
||||
<input class="apop_search_order" type="radio" name="_apop_search_order"
|
||||
value="2"<?php checked( $apop_search_order_check, 2 ); ?>>ドラッグソート</label>
|
||||
</li>
|
||||
</ul>
|
||||
<?php
|
||||
$order_target_type = '_apop_search_order';
|
||||
$order_target = APOP_UI::get_order_type( $order_target_type );
|
||||
?>
|
||||
<?php include APOP_PLUGIN_PATH . 'template/order_parts_menu.php'; ?>
|
||||
<hr>
|
||||
<div class="search_sort_box">
|
||||
<?php list( $list, $alert ) = APOP_UI::create_search_normal_list( 'search' ); ?>
|
||||
<div class="sort_box">
|
||||
<?php list( $list, $alert, $field_metakey_input ) = APOP_UI::create_search_normal_list( 'search' ); ?>
|
||||
<?php echo $alert; ?>
|
||||
<ul class="post-order-list search_normal_sort">
|
||||
<?php echo $list; ?>
|
||||
</ul>
|
||||
<?php echo $field_metakey_input; ?>
|
||||
</div>
|
||||
|
||||
<div class="search_sort_box">
|
||||
<div class="sort_box">
|
||||
<?php echo APOP_UI::none_registered_alert_msg(); ?>
|
||||
<ul class="post-order-list">
|
||||
<?php echo APOP_UI::get_all_search_normal_posts( 'search' ); ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="submit_type" value="1">
|
||||
<p class="submit post-order"><input type="submit" name="Submit" class="button-primary"
|
||||
value="変更を保存"/></p>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-order-box">
|
||||
<?php foreach ( $category_lists as $tax_key => $tax_list ) : ?>
|
||||
<div class="list-orders-outer">
|
||||
<?php if ( count( $tax_list ) > 0 ): ?>
|
||||
<?php echo APOP_UI::none_registered_alert_msg(); ?>
|
||||
<?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 echo APOP_UI::create_order_list( $tax_data, $tax_key ); ?>
|
||||
</ul>
|
||||
<input type="hidden" name="submit_type" value="2">
|
||||
<p class="submit post-order"><input type="submit" name="Submit"
|
||||
class="button-primary"
|
||||
value="変更を保存"/></p>
|
||||
</form>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<?php echo APOP_UI::create_none_select_msg( 'カテゴリー' ); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<div class="tax_sort_box">
|
||||
<?php
|
||||
$tax_lists = array( 'category' => APOP_UI::get_cat_tag_list( 'cat', 'category' ) );
|
||||
$tax_title_text = 'カテゴリー';
|
||||
$submit_type_number = 2;
|
||||
?>
|
||||
<?php include APOP_PLUGIN_PATH . 'template/order_parts_taxonomy.php'; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-order-box">
|
||||
<?php foreach ( $tag_lists as $tax_key => $tax_list ) : ?>
|
||||
<div class="list-orders-outer">
|
||||
<?php if ( count( $tax_list ) > 0 ): ?>
|
||||
<?php echo APOP_UI::none_registered_alert_msg(); ?>
|
||||
<?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 echo APOP_UI::create_order_list( $tax_data, $tax_key ); ?>
|
||||
</ul>
|
||||
<input type="hidden" name="submit_type" value="3">
|
||||
<p class="submit post-order"><input type="submit" name="Submit"
|
||||
class="button-primary"
|
||||
value="変更を保存"/></p>
|
||||
</form>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<?php echo APOP_UI::create_none_select_msg( 'タグ' ); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<div class="tax_sort_box">
|
||||
<?php
|
||||
$tax_lists = array( 'tag_id' => APOP_UI::get_cat_tag_list( 'tag', 'post_tag' ) );
|
||||
$tax_title_text = 'タグ';
|
||||
$submit_type_number = 3;
|
||||
?>
|
||||
<?php include APOP_PLUGIN_PATH . 'template/order_parts_taxonomy.php'; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-order-box">
|
||||
<?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 ): ?>
|
||||
<?php echo APOP_UI::none_registered_alert_msg(); ?>
|
||||
<?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 echo APOP_UI::create_order_list( $tax_data, $tax_key ); ?>
|
||||
</ul>
|
||||
<input type="hidden" name="submit_type" value="4">
|
||||
<p class="submit post-order"><input type="submit" name="Submit"
|
||||
class="button-primary"
|
||||
value="変更を保存"/></p>
|
||||
</form>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php if ( count( $taxonomy_lists['taxonomy'] ) == 0 ): ?>
|
||||
<?php echo APOP_UI::create_none_select_msg( 'カスタム分類' ); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<div class="tax_sort_box">
|
||||
<?php
|
||||
$tax_lists = array( 'taxonomy' => APOP_UI::get_cat_tag_list( 'tax', 'taxonomy' ) );
|
||||
$tax_title_text = 'カスタム分類';
|
||||
$submit_type_number = 4;
|
||||
?>
|
||||
<?php include APOP_PLUGIN_PATH . 'template/order_parts_taxonomy.php'; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php if ( isset( $order_target, $order_target_type ) ): ?>
|
||||
<ul class="sort_menu_list"
|
||||
data-order_target="<?php echo $order_target; ?>">
|
||||
<li><label>
|
||||
<input class="sort_menu" type="radio" name="<?php echo $order_target_type; ?>"
|
||||
value="1"<?php checked( $order_target, 1 ); ?>>標準+カスタムフィールドソート</label></li>
|
||||
<li><label>
|
||||
<input class="sort_menu" type="radio" name="<?php echo $order_target_type; ?>"
|
||||
value="2"<?php checked( $order_target, 2 ); ?>>ドラッグソート</label></li>
|
||||
</ul>
|
||||
<?php endif;
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php if ( isset( $tax_lists, $tax_title_text, $submit_type_number ) ): ?>
|
||||
<?php foreach ( $tax_lists as $tax_key => $tax_list ) : ?>
|
||||
<div class="list-orders-outer">
|
||||
<?php if ( count( $tax_list ) > 0 ): ?>
|
||||
<?php echo APOP_UI::none_registered_alert_msg(); ?>
|
||||
<?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>
|
||||
<?php
|
||||
$order_target_data = get_option( '_apop_tax_sort_type' );
|
||||
if ( isset( $order_target_data[ $tax_data->term_id ] ) ) {
|
||||
$order_target = $order_target_data[ $tax_data->term_id ];
|
||||
} else {
|
||||
$order_target = 1;
|
||||
}
|
||||
?>
|
||||
<ul class="sort_menu_list"
|
||||
data-order_target="<?php echo $order_target; ?>">
|
||||
<li>
|
||||
<label>
|
||||
<input class="sort_menu" type="radio"
|
||||
name="_apop_tax_sort_type[<?php echo $tax_data->term_id; ?>]"
|
||||
value="1"<?php checked( $order_target, 1 ); ?>>ドラッグソート</label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input class="sort_menu" type="radio"
|
||||
name="_apop_tax_sort_type[<?php echo $tax_data->term_id; ?>]"
|
||||
value="2"<?php checked( $order_target, 2 ); ?>>標準+カスタムフィールドソート</label>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="sort_box">
|
||||
<ul class="post-order-list">
|
||||
<?php echo APOP_UI::create_order_list( $tax_data, $tax_key ); ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="sort_box">
|
||||
<?php list( $list, $alert, $field_metakey_input ) = APOP_UI::create_search_normal_list( 'tax', $tax_data->term_id ); ?>
|
||||
<?php echo $alert; ?>
|
||||
<ul class="post-order-list search_normal_sort">
|
||||
<?php echo $list; ?>
|
||||
</ul>
|
||||
<?php echo $field_metakey_input; ?>
|
||||
</div>
|
||||
<input type="hidden" name="submit_type" value="<?php echo $submit_type_number; ?>">
|
||||
<p class="submit post-order"><input type="submit" name="Submit"
|
||||
class="button-primary"
|
||||
value="変更を保存"/></p>
|
||||
<input type="hidden" name="sort_type[cat]" value="1">
|
||||
</form>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<?php echo APOP_UI::create_none_select_msg( $tax_title_text ); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif;
|
||||
Reference in New Issue
Block a user