WP PLUGIN アーカイブページの投稿表示順設定
・検索と通常表示のオプションを追加 ・項目の表示順を修正 ・選択値によって表示/非表示の切り替えやフォームをDisabledにする等修正 ・アンインストーラーを追加
This commit is contained in:
+73
-29
@@ -29,7 +29,7 @@ if ( ! class_exists( 'APOP' ) ) {
|
|||||||
add_submenu_page(
|
add_submenu_page(
|
||||||
'apop_post_sort', // parent_slug
|
'apop_post_sort', // parent_slug
|
||||||
'Sort taxonomy', // page_title
|
'Sort taxonomy', // page_title
|
||||||
'設定', // menu_title
|
'表示件数・対象設定', // menu_title
|
||||||
'administrator', // capability
|
'administrator', // capability
|
||||||
'apop_post_sort', // menu_slug
|
'apop_post_sort', // menu_slug
|
||||||
array( $this, 'display_setting_page' ) // function
|
array( $this, 'display_setting_page' ) // function
|
||||||
@@ -45,11 +45,6 @@ if ( ! class_exists( 'APOP' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function display_setting_page() {
|
public function display_setting_page() {
|
||||||
if ( isset( $_POST['_apop_cat_order'] )
|
|
||||||
|| isset( $_POST['_apop_tag_order'] )
|
|
||||||
|| isset( $_POST['_apop_tax_order'] ) ) {
|
|
||||||
|
|
||||||
check_admin_referer( 'sh_options' );
|
|
||||||
|
|
||||||
$settings = array(
|
$settings = array(
|
||||||
'_apop_cat_order', //カテゴリー設定
|
'_apop_cat_order', //カテゴリー設定
|
||||||
@@ -57,51 +52,101 @@ if ( ! class_exists( 'APOP' ) ) {
|
|||||||
'_apop_tag_order', //タグ設定
|
'_apop_tag_order', //タグ設定
|
||||||
'_apop_tax_order', //カスタムタクソノミー設定
|
'_apop_tax_order', //カスタムタクソノミー設定
|
||||||
);
|
);
|
||||||
foreach ( $settings as $setting ) {
|
|
||||||
$opt = $_POST[ $setting ];
|
|
||||||
update_option( $setting, $opt );
|
|
||||||
}
|
|
||||||
require_once self::TEMPLATE_DIR . 'success.php';
|
|
||||||
|
|
||||||
|
foreach ( $settings as $setting ) {
|
||||||
|
$opt = APOP_UI::input_post_filter( $setting, 'array' );
|
||||||
|
if ( $opt ) {
|
||||||
|
check_admin_referer( 'sh_options' );
|
||||||
|
update_option( $setting, $opt );
|
||||||
|
require_once self::TEMPLATE_DIR . 'success.php';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once self::TEMPLATE_DIR . 'setting.php';
|
require_once self::TEMPLATE_DIR . 'setting.php';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function show_option_page() {
|
public function show_option_page() {
|
||||||
|
//-------------------------------------
|
||||||
|
// 通常表示
|
||||||
|
// ------------------------------------
|
||||||
|
$apop_normal_order = APOP_UI::input_post_filter( '_apop_normal_order', 'str' );
|
||||||
|
$apop_normal_order_param = APOP_UI::input_post_filter( '_apop_normal_order_param', 'array' );
|
||||||
|
$apop_post_normal = APOP_UI::input_post_filter( '_apop_post_normal', 'array' );
|
||||||
|
|
||||||
//検索の投稿表示順設定
|
if ( $apop_normal_order ) {
|
||||||
if ( isset( $_POST['_apop_post_search'] ) ) {
|
|
||||||
check_admin_referer( 'sh_options' );
|
check_admin_referer( 'sh_options' );
|
||||||
$this->update_search_sort( 'search' );
|
update_option( '_apop_normal_order', $apop_normal_order );
|
||||||
require_once self::TEMPLATE_DIR . 'success.php';
|
require_once self::TEMPLATE_DIR . 'success.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $_POST['_apop_search_order'] ) ) {
|
//表示順設定
|
||||||
|
if ( $apop_normal_order_param ) {
|
||||||
check_admin_referer( 'sh_options' );
|
check_admin_referer( 'sh_options' );
|
||||||
update_option( '_apop_search_order', $_POST['_apop_search_order'] );
|
update_option( '_apop_normal_order_param', $apop_normal_order_param );
|
||||||
require_once self::TEMPLATE_DIR . 'success.php';
|
require_once self::TEMPLATE_DIR . 'success.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//カスタム表示順設定
|
||||||
|
if ( $apop_post_normal ) {
|
||||||
|
check_admin_referer( 'sh_options' );
|
||||||
|
$this->update_search_normal_sort( $apop_post_normal, 'normal' );
|
||||||
|
require_once self::TEMPLATE_DIR . 'success.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------
|
||||||
|
// 検索表示
|
||||||
|
// ------------------------------------
|
||||||
|
$apop_search_order = APOP_UI::input_post_filter( '_apop_search_order', 'str' );
|
||||||
|
$apop_search_order_param = APOP_UI::input_post_filter( '_apop_search_order_param', 'array' );
|
||||||
|
$apop_post_search = APOP_UI::input_post_filter( '_apop_post_search', 'array' );
|
||||||
|
|
||||||
|
if ( $apop_search_order ) {
|
||||||
|
check_admin_referer( 'sh_options' );
|
||||||
|
update_option( '_apop_search_order', $apop_search_order );
|
||||||
|
require_once self::TEMPLATE_DIR . 'success.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
//表示順設定
|
||||||
|
if ( $apop_search_order_param ) {
|
||||||
|
check_admin_referer( 'sh_options' );
|
||||||
|
update_option( '_apop_search_order_param', $apop_search_order_param );
|
||||||
|
require_once self::TEMPLATE_DIR . 'success.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
//カスタム表示順設定
|
||||||
|
if ( $apop_post_search ) {
|
||||||
|
check_admin_referer( 'sh_options' );
|
||||||
|
$this->update_search_normal_sort( $apop_post_search, 'search' );
|
||||||
|
require_once self::TEMPLATE_DIR . 'success.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------
|
||||||
|
// タクソノミー
|
||||||
|
// ------------------------------------
|
||||||
|
$apop_post_category = APOP_UI::input_post_filter( '_apop_post_category', 'array' );
|
||||||
|
$apop_post_post_tag = APOP_UI::input_post_filter( '_apop_post_post_tag', 'array' );
|
||||||
|
$apop_post_tax = APOP_UI::input_post_filter( '_apop_post_tax', 'array' );
|
||||||
|
|
||||||
//カテゴリーの投稿表示順設定
|
//カテゴリーの投稿表示順設定
|
||||||
if ( isset( $_POST['_apop_post_category'] ) ) {
|
if ( $apop_post_category ) {
|
||||||
check_admin_referer( 'sh_options' );
|
check_admin_referer( 'sh_options' );
|
||||||
$this->update_post_sort( 'category' );
|
$this->update_post_sort( 'category', $apop_post_category );
|
||||||
require_once self::TEMPLATE_DIR . 'success.php';
|
require_once self::TEMPLATE_DIR . 'success.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
//タグの投稿表示順設定
|
//タグの投稿表示順設定
|
||||||
if ( isset( $_POST['_apop_post_post_tag'] ) ) {
|
if ( $apop_post_post_tag ) {
|
||||||
check_admin_referer( 'sh_options' );
|
check_admin_referer( 'sh_options' );
|
||||||
$this->update_post_sort( 'post_tag' );
|
$this->update_post_sort( 'post_tag', $apop_post_post_tag );
|
||||||
require_once self::TEMPLATE_DIR . 'success.php';
|
require_once self::TEMPLATE_DIR . 'success.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
//カスタム分類の投稿表示順設定
|
//カスタム分類の投稿表示順設定
|
||||||
if ( isset( $_POST['_apop_post_tax'] ) ) {
|
if ( $apop_post_tax ) {
|
||||||
check_admin_referer( 'sh_options' );
|
check_admin_referer( 'sh_options' );
|
||||||
$this->update_post_sort( 'tax' );
|
$this->update_post_sort( 'tax', $apop_post_tax );
|
||||||
require_once self::TEMPLATE_DIR . 'success.php';
|
require_once self::TEMPLATE_DIR . 'success.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,21 +154,20 @@ if ( ! class_exists( 'APOP' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//投稿表示順の設定
|
//投稿表示順の設定
|
||||||
private function update_post_sort( $target ) {
|
private function update_post_sort( $target, $post_value ) {
|
||||||
$target = '_apop_post_' . $target;
|
$posts_sort = $post_value['post_sort'];
|
||||||
$posts_sort = $_POST[ $target ]['post_sort'];
|
|
||||||
foreach ( $posts_sort as $cat_id => $posts ) {
|
foreach ( $posts_sort as $cat_id => $posts ) {
|
||||||
$sort_key = $target . '_' . $cat_id;
|
$sort_key = '_apop_post_' . $target . '_' . $cat_id;
|
||||||
foreach ( $posts as $post_id => $sort ) {
|
foreach ( $posts as $post_id => $sort ) {
|
||||||
update_post_meta( $post_id, $sort_key, $sort );
|
update_post_meta( $post_id, $sort_key, $sort );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function update_search_sort() {
|
private function update_search_normal_sort( $apop_post_search_normal, $key ) {
|
||||||
$posts_sort = $_POST['_apop_post_search']['post_sort'];
|
$posts_sort = $apop_post_search_normal['post_sort'];
|
||||||
foreach ( $posts_sort as $post_id => $sort ) {
|
foreach ( $posts_sort as $post_id => $sort ) {
|
||||||
update_post_meta( $post_id, '_apop_post_search', $sort );
|
update_post_meta( $post_id, '_apop_post_' . $key, $sort );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+109
-7
@@ -6,7 +6,16 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
if ( ! class_exists( 'APOP_UI' ) ) {
|
if ( ! class_exists( 'APOP_UI' ) ) {
|
||||||
class APOP_UI {
|
class APOP_UI {
|
||||||
|
|
||||||
public static function get_all_search_posts( $type, $exclude_posts = [] ) {
|
public static function get_order_type( $type ) {
|
||||||
|
$type_data = get_option( $type );
|
||||||
|
if ( ! $type_data ) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $type_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function get_all_search_normal_posts( $type, $key, $exclude_posts = [] ) {
|
||||||
$args = [
|
$args = [
|
||||||
'post_status' => array( 'publish', 'draft' ),
|
'post_status' => array( 'publish', 'draft' ),
|
||||||
'posts_per_page' => - 1,
|
'posts_per_page' => - 1,
|
||||||
@@ -15,13 +24,14 @@ if ( ! class_exists( 'APOP_UI' ) ) {
|
|||||||
if ( $type == 'registered' ) {
|
if ( $type == 'registered' ) {
|
||||||
$args['orderby'] = 'meta_value_num';
|
$args['orderby'] = 'meta_value_num';
|
||||||
$args['order'] = 'ASC';
|
$args['order'] = 'ASC';
|
||||||
$args['meta_key'] = '_apop_post_search';
|
$args['meta_key'] = '_apop_post_' . $key;
|
||||||
} else {
|
} else {
|
||||||
$exclude = implode( ',', $exclude_posts );
|
$exclude = implode( ',', $exclude_posts );
|
||||||
if ( ! empty( $exclude ) ) {
|
if ( ! empty( $exclude ) ) {
|
||||||
$args['exclude'] = $exclude;
|
$args['exclude'] = $exclude;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return get_posts( $args );
|
return get_posts( $args );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +166,7 @@ value="' . $sort_num . '">
|
|||||||
foreach ( $target_posts_no_order as $key => $target_post_no_order ) {
|
foreach ( $target_posts_no_order as $key => $target_post_no_order ) {
|
||||||
$sort_num_no_order = $sort_num + $key + 1;
|
$sort_num_no_order = $sort_num + $key + 1;
|
||||||
$list[] = '
|
$list[] = '
|
||||||
<li class="product-list no_order">
|
<li class="product-list no_order">■
|
||||||
<span class="sort-num-label">' . $sort_num_no_order . '</span>' . get_the_title( $target_post_no_order->ID ) . '
|
<span class="sort-num-label">' . $sort_num_no_order . '</span>' . get_the_title( $target_post_no_order->ID ) . '
|
||||||
<input type="hidden" class="list_order"
|
<input type="hidden" class="list_order"
|
||||||
name="_apop_post_' . self::create_post_sort_key( $tax_data->taxonomy, $tax_key ) . '[post_sort][' . $tax_data->term_id . '][' . $target_post_no_order->ID . ']"
|
name="_apop_post_' . self::create_post_sort_key( $tax_data->taxonomy, $tax_key ) . '[post_sort][' . $tax_data->term_id . '][' . $target_post_no_order->ID . ']"
|
||||||
@@ -190,20 +200,112 @@ value="' . $sort_num_no_order . '">
|
|||||||
|
|
||||||
public static function create_cat_per_page( $opt_per_page, $type ): array {
|
public static function create_cat_per_page( $opt_per_page, $type ): array {
|
||||||
$cat_per_page = $opt_per_page[ $type ] ?? 'default';
|
$cat_per_page = $opt_per_page[ $type ] ?? 'default';
|
||||||
$set = '';
|
$checked = '';
|
||||||
$cat_per_page_num = '';
|
$cat_per_page_num = '';
|
||||||
if ( isset( $opt_per_page[ $type ] ) ) {
|
if ( isset( $opt_per_page[ $type ] ) ) {
|
||||||
if ( $opt_per_page[ $type ] != 'default' && $opt_per_page[ $type ] != '-1' ) {
|
if ( $opt_per_page[ $type ] != 'default'
|
||||||
$set = ' checked="checked"';
|
&& $opt_per_page[ $type ] != '-1'
|
||||||
|
&& $opt_per_page[ $type ] != 'all' ) {
|
||||||
|
$checked = ' checked="checked"';
|
||||||
$cat_per_page_num = $cat_per_page;
|
$cat_per_page_num = $cat_per_page;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'_per_page' => $cat_per_page,
|
'_per_page' => $cat_per_page,
|
||||||
'_set' => $set,
|
'_checked' => $checked,
|
||||||
'_per_page_num' => $cat_per_page_num,
|
'_per_page_num' => $cat_per_page_num,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function create_search_normal_list( $type ): array {
|
||||||
|
$name_key = 'apop_' . $type . '_order_param';
|
||||||
|
$order_param = get_option( '_' . $name_key );
|
||||||
|
$target_keys = self::set_search_normal_target_keys( $order_param );
|
||||||
|
$target_values = array(
|
||||||
|
'date' => '登録日',
|
||||||
|
'title' => 'タイトル',
|
||||||
|
'ID' => 'ID',
|
||||||
|
'modified' => '更新日',
|
||||||
|
);
|
||||||
|
$list = array();
|
||||||
|
foreach ( $target_keys as $target_key ) {
|
||||||
|
$use = $order_param[ $target_key ]['use'] ?? 0;
|
||||||
|
$sort = $order_param[ $target_key ]['sort'] ?? 2;
|
||||||
|
$alert = ! $order_param[ $target_key ]['use'] ? '<p>並べ替えを登録するには「変更を保存」をクリックしてください。</p>' : '';
|
||||||
|
$no_order_class = ! $order_param[ $target_key ]['use'] ? ' no_order' : '';
|
||||||
|
$list[] = '<li class="product-list' . $no_order_class . '">
|
||||||
|
<label>
|
||||||
|
<input type="hidden" name="_' . $name_key . '[' . $target_key . '][use]" value="0"' . self::set_search_normal_checked( $use, 0 ) . '>
|
||||||
|
<input type="checkbox" name="_' . $name_key . '[' . $target_key . '][use]" value="1"' . self::set_search_normal_checked( $use, 1 ) . '>
|
||||||
|
<b>' . $target_values[ $target_key ] . '</b>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label><input class="' . $name_key . '" type="radio"
|
||||||
|
name="_' . $name_key . '[' . $target_key . '][sort]"
|
||||||
|
value="1"' . self::set_search_normal_checked( $sort, 1 ) . '>昇順</label>
|
||||||
|
|
||||||
|
<label><input class="' . $name_key . '" type="radio"
|
||||||
|
name="_' . $name_key . '[' . $target_key . '][sort]"
|
||||||
|
value="2"' . self::set_search_normal_checked( $sort, 2 ) . '>降順</label>
|
||||||
|
</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
implode( PHP_EOL, $list ),
|
||||||
|
$alert,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function set_search_normal_target_keys( $post_apop_search_order_param ) {
|
||||||
|
if ( $post_apop_search_order_param ) {
|
||||||
|
return array_keys( $post_apop_search_order_param );
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'date',
|
||||||
|
'title',
|
||||||
|
'ID',
|
||||||
|
'modified',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function set_search_normal_checked( $param, $default ): string {
|
||||||
|
if ( $param == $default ) {
|
||||||
|
return ' checked="checked"';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function input_post_filter( $var_name, $type ) {
|
||||||
|
if ( $type == 'array' ) {
|
||||||
|
return filter_input( INPUT_POST, $var_name, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
|
||||||
|
}
|
||||||
|
if ( $type == 'str' ) {
|
||||||
|
return filter_input( INPUT_POST, $var_name );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function is_disp_per_page( &$disp, $disp_per_page ) {
|
||||||
|
if ( $disp_per_page ) {
|
||||||
|
$disp = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function create_disp_class( $disp ) {
|
||||||
|
if ( ! $disp ) {
|
||||||
|
return ' class="hide_list"';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function create_none_select_msg( $str ) {
|
||||||
|
return '<p>並べ替えをカスタマイズする' . $str . 'は選択されていません。</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function none_registerd_alert_msg() {
|
||||||
|
return '<div class="no_registered_exp">■の項目は未登録項目です。ドラッグして並び順を変更後に「変更を保存」をクリックしてください。</div>';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+61
-6
@@ -1,5 +1,9 @@
|
|||||||
@charset "UTF-8";
|
@charset "UTF-8";
|
||||||
|
|
||||||
|
.post-order-nav {
|
||||||
|
width: 95%;
|
||||||
|
}
|
||||||
|
|
||||||
.post-order-nav ul {
|
.post-order-nav ul {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
@@ -61,10 +65,12 @@ h3 {
|
|||||||
width: calc((100% - 10px) / 2);
|
width: calc((100% - 10px) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.apop_normal_order_target,
|
||||||
.apop_search_order_target {
|
.apop_search_order_target {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.apop_normal_order_target li:first-child,
|
||||||
.apop_search_order_target li:first-child {
|
.apop_search_order_target li:first-child {
|
||||||
margin-right: 2em;
|
margin-right: 2em;
|
||||||
}
|
}
|
||||||
@@ -75,19 +81,20 @@ p.submit.post-order .button-primary {
|
|||||||
right: 1.5em;
|
right: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.post_per_page_list {
|
dl.apop_setting_list {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
margin-top: .5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.post_per_page_list dt {
|
dl.apop_setting_list dt {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.post_per_page_list dd {
|
dl.apop_setting_list dd {
|
||||||
margin-left: 200px;
|
margin-left: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.post_per_page_list dd:first-of-type {
|
dl.apop_setting_list dd:first-of-type {
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,6 +115,15 @@ dl.post_per_page_list dd:first-of-type {
|
|||||||
border: 1px solid #ababab;
|
border: 1px solid #ababab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search_normal_sort .product-list {
|
||||||
|
padding: 1em .5em;
|
||||||
|
border-radius: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search_normal_sort .product-list label:first-of-type {
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
.product-list.no_order {
|
.product-list.no_order {
|
||||||
background: #ababab;
|
background: #ababab;
|
||||||
}
|
}
|
||||||
@@ -124,6 +140,45 @@ dl.post_per_page_list dd:first-of-type {
|
|||||||
content: "]";
|
content: "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
.per_page_cat_input {
|
.hide_list {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no_registered_exp {
|
||||||
|
margin-top: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 964px) {
|
||||||
|
|
||||||
|
.post-order-nav {
|
||||||
|
width: 98%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-orders-outer {
|
||||||
|
display: block;;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-orders-inner.search_inner {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-orders-inner {
|
||||||
|
width: 100%;
|
||||||
|
margin: 1.5em 0 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.apop_setting_list dt {
|
||||||
|
float: none;
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.apop_setting_list dd {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.apop_setting_list li label input[type="text"] {
|
||||||
|
width: 95%;
|
||||||
|
margin-top: .5em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+72
-17
@@ -1,10 +1,21 @@
|
|||||||
jQuery(function ($) {
|
jQuery(function ($) {
|
||||||
|
|
||||||
|
//tab menu
|
||||||
change_tab_menu();
|
change_tab_menu();
|
||||||
|
|
||||||
|
//custom orders
|
||||||
order_list();
|
order_list();
|
||||||
|
|
||||||
|
//order type
|
||||||
|
change_search_order();
|
||||||
|
change_normal_order();
|
||||||
|
|
||||||
|
en_search_normal_sort_btn()
|
||||||
|
|
||||||
|
//per page
|
||||||
|
disp_tax_per_page();
|
||||||
|
change_normal_per_page();
|
||||||
change_search_per_page();
|
change_search_per_page();
|
||||||
change_search_order_options();
|
|
||||||
change_cat_per_page();
|
change_cat_per_page();
|
||||||
change_tag_per_page();
|
change_tag_per_page();
|
||||||
change_tax_per_page();
|
change_tax_per_page();
|
||||||
@@ -51,6 +62,65 @@ jQuery(function ($) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function change_normal_order() {
|
||||||
|
let s_radio = $('.apop_normal_order');
|
||||||
|
let s_box = $('.normal_sort_box');
|
||||||
|
let default_index = $('.apop_normal_order_target').data('normal_order_target') - 1;
|
||||||
|
|
||||||
|
s_box.hide().find('input').each(function () {
|
||||||
|
$(this).prop('disabled', true);
|
||||||
|
});
|
||||||
|
$('.normal_sort_box:eq(' + default_index + ')').show().find('input').prop('disabled', false);
|
||||||
|
|
||||||
|
s_radio.click(function () {
|
||||||
|
let target_index = $(this).val() - 1;
|
||||||
|
s_box.hide().find('input').each(function () {
|
||||||
|
$(this).prop('disabled', true);
|
||||||
|
});
|
||||||
|
$('.normal_sort_box:eq(' + target_index + ')').show().find('input').prop('disabled', false);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function change_search_order() {
|
||||||
|
let s_radio = $('.apop_search_order');
|
||||||
|
let s_box = $('.search_sort_box');
|
||||||
|
let default_index = $('.apop_search_order_target').data('search_order_target') - 1;
|
||||||
|
|
||||||
|
s_box.hide().find('input').each(function () {
|
||||||
|
$(this).prop('disabled', true);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.search_sort_box:eq(' + default_index + ')').show().find('input').prop('disabled', false);
|
||||||
|
|
||||||
|
s_radio.click(function () {
|
||||||
|
let target_index = $(this).val() - 1;
|
||||||
|
s_box.hide().find('input').each(function () {
|
||||||
|
$(this).prop('disabled', true);
|
||||||
|
});
|
||||||
|
$('.search_sort_box:eq(' + target_index + ')').show().find('input').prop('disabled', false);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function disp_tax_per_page() {
|
||||||
|
let box_count = $('.order_setting_list').length;
|
||||||
|
for (let i = 0; i < box_count; i++) {
|
||||||
|
$('.order_setting_list:eq(' + i + ')').click(function () {
|
||||||
|
let en_count = $('.order_setting_list:eq(' + i + ') [name^="_apop_"]:checked').length;
|
||||||
|
if (en_count == 0) {
|
||||||
|
$(this).parent().next('dt').addClass('hide_list').next('dd').addClass('hide_list');
|
||||||
|
} else {
|
||||||
|
$(this).parent().next('dt').removeClass('hide_list').next('dd').removeClass('hide_list');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function change_normal_per_page() {
|
||||||
|
let per_page_cat = $('.per_page_normal');
|
||||||
|
let per_page_input = $('.per_page_normal_input');
|
||||||
|
change_per_page(per_page_cat, per_page_input);
|
||||||
|
}
|
||||||
|
|
||||||
function change_search_per_page() {
|
function change_search_per_page() {
|
||||||
let per_page_cat = $('.per_page_search');
|
let per_page_cat = $('.per_page_search');
|
||||||
let per_page_input = $('.per_page_search_input');
|
let per_page_input = $('.per_page_search_input');
|
||||||
@@ -82,7 +152,7 @@ jQuery(function ($) {
|
|||||||
per_page_input.prop('disabled', false);
|
per_page_input.prop('disabled', false);
|
||||||
}
|
}
|
||||||
per_page_cat.click(function () {
|
per_page_cat.click(function () {
|
||||||
if ($(this).val() == 'set') {
|
if ($(this).val() != 'default' && $(this).val() != '-1' && $(this).val() != 'all') {
|
||||||
per_page_input.prop('disabled', false);
|
per_page_input.prop('disabled', false);
|
||||||
} else {
|
} else {
|
||||||
per_page_input.val('');
|
per_page_input.val('');
|
||||||
@@ -91,19 +161,4 @@ jQuery(function ($) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function change_search_order_options() {
|
|
||||||
let s_radio = $('.apop_search_order');
|
|
||||||
let s_box = $('.search_sort_box');
|
|
||||||
let default_index = $('.apop_search_order_target').data('search_order_target') - 1;
|
|
||||||
|
|
||||||
s_box.hide();
|
|
||||||
$('.search_sort_box:eq(' + default_index + ')').show();
|
|
||||||
|
|
||||||
s_radio.click(function () {
|
|
||||||
let target_index = $(this).val() - 1;
|
|
||||||
s_box.hide();
|
|
||||||
$('.search_sort_box:eq(' + target_index + ')').show();
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
+123
-114
@@ -1,15 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
$search_lists = APOP_UI::get_all_search_posts( 'registered' );
|
$normal_lists = APOP_UI::get_all_search_normal_posts( 'registered', 'normal' );
|
||||||
|
$search_lists = APOP_UI::get_all_search_normal_posts( 'registered', 'search' );
|
||||||
$category_lists = array( 'category' => APOP_UI::get_cat_tag_list( 'cat', 'category' ) );
|
$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' ) );
|
$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' ) );
|
$taxonomy_lists = array( 'taxonomy' => APOP_UI::get_cat_tag_list( 'tax', 'taxonomy' ) );
|
||||||
$submit_type = $_POST['submit_type'] ?? '0';
|
$submit_type = APOP_UI::input_post_filter( 'submit_type', 'str' );
|
||||||
$apop_search_order = get_option( '_apop_search_order' ) ?? '1';
|
$apop_search_order_check = APOP_UI::get_order_type( '_apop_search_order' );
|
||||||
|
$apop_normal_check = APOP_UI::get_order_type( '_apop_normal_order' );
|
||||||
?>
|
?>
|
||||||
<h2>並べ替え</h2>
|
<h2>並べ替え</h2>
|
||||||
<nav class="post-order-nav">
|
<nav class="post-order-nav">
|
||||||
<ul>
|
<ul>
|
||||||
<li class="en">検索</li>
|
<li class="en">通常</li>
|
||||||
|
<li>検索</li>
|
||||||
<li>カテゴリー</li>
|
<li>カテゴリー</li>
|
||||||
<li>タグ</li>
|
<li>タグ</li>
|
||||||
<li>カスタム分類</li>
|
<li>カスタム分類</li>
|
||||||
@@ -22,115 +25,46 @@ $apop_search_order = get_option( '_apop_search_order' ) ?? '1';
|
|||||||
<div class="list-orders-inner search_inner">
|
<div class="list-orders-inner search_inner">
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
<?php wp_nonce_field( 'sh_options' ); ?>
|
<?php wp_nonce_field( 'sh_options' ); ?>
|
||||||
<ul class="apop_search_order_target" data-search_order_target="<?php echo $apop_search_order; ?>">
|
<ul class="apop_normal_order_target"
|
||||||
|
data-normal_order_target="<?php echo $apop_normal_check; ?>">
|
||||||
<li><label>
|
<li><label>
|
||||||
<input class="apop_search_order" type="radio" name="_apop_search_order"
|
<input class="apop_normal_order" type="radio" name="_apop_normal_order"
|
||||||
value="1"<?php echo checked( $apop_search_order, 1 ); ?>>標準</label></li>
|
value="1"<?php checked( $apop_normal_check, 1 ); ?>>標準</label></li>
|
||||||
<li><label>
|
<li><label>
|
||||||
<input class="apop_search_order" type="radio" name="_apop_search_order"
|
<input class="apop_normal_order" type="radio" name="_apop_normal_order"
|
||||||
value="2"<?php echo checked( $apop_search_order, 2 ); ?>>カスタム</label></li>
|
value="2"<?php checked( $apop_normal_check, 2 ); ?>>カスタム</label></li>
|
||||||
</ul>
|
</ul>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="search_sort_box">
|
<div class="normal_sort_box">
|
||||||
|
<?php list( $list, $alert ) = APOP_UI::create_search_normal_list( 'normal' ); ?>
|
||||||
|
<?php echo $alert; ?>
|
||||||
<ul class="post-order-list search_normal_sort">
|
<ul class="post-order-list search_normal_sort">
|
||||||
<li class="product-list">
|
<?php echo $list; ?>
|
||||||
<label>
|
|
||||||
<input type="hidden" name="_apop_search_order_param[id][use]" value="0">
|
|
||||||
<input type="checkbox" name="_apop_search_order_param[id][use]" value="1">
|
|
||||||
<b>ID</b>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label><input class="apop_search_order_param" type="radio"
|
|
||||||
name="_apop_search_order_param[id][sort]"
|
|
||||||
value="1">昇順</label>
|
|
||||||
|
|
||||||
<label><input class="apop_search_order_param" type="radio"
|
|
||||||
name="_apop_search_order_param[id][sort]"
|
|
||||||
value="2">降順
|
|
||||||
</label>
|
|
||||||
<input type="hidden" class="list_order"
|
|
||||||
name="_apop_search_order_param[post_sort][id]"
|
|
||||||
value="">
|
|
||||||
</li>
|
|
||||||
<li class="product-list">
|
|
||||||
<label>
|
|
||||||
<input type="hidden" name="_apop_search_order_param[title][use]" value="0">
|
|
||||||
<input type="checkbox" name="_apop_search_order_param[title][use]" value="1">
|
|
||||||
<b>タイトル</b>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label><input class="apop_search_order_param" type="radio"
|
|
||||||
name="_apop_search_order_param[title][sort]"
|
|
||||||
value="1">昇順</label>
|
|
||||||
|
|
||||||
<label><input class="apop_search_order_param" type="radio"
|
|
||||||
name="_apop_search_order_param[title][sort]"
|
|
||||||
value="2">降順
|
|
||||||
</label>
|
|
||||||
<input type="hidden" class="list_order"
|
|
||||||
name="_apop_search_order_param[post_sort][title]"
|
|
||||||
value="">
|
|
||||||
</li>
|
|
||||||
<li class="product-list">
|
|
||||||
<label>
|
|
||||||
<input type="hidden" name="_apop_search_order_param[register][use]" value="0">
|
|
||||||
<input type="checkbox" name="_apop_search_order_param[register][use]" value="1">
|
|
||||||
<b>登録日</b>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label><input class="apop_search_order_param" type="radio"
|
|
||||||
name="_apop_search_order_param[register][sort]"
|
|
||||||
value="1">昇順</label>
|
|
||||||
|
|
||||||
<label><input class="apop_search_order_param" type="radio"
|
|
||||||
name="_apop_search_order_param[register][sort]"
|
|
||||||
value="2">降順</label>
|
|
||||||
<input type="hidden" class="list_order"
|
|
||||||
name="_apop_search_order_param[post_sort][register]"
|
|
||||||
value="">
|
|
||||||
</li>
|
|
||||||
<li class="product-list">
|
|
||||||
<label>
|
|
||||||
<input type="hidden" name="_apop_search_order_param[modified][use]" value="0">
|
|
||||||
<input type="checkbox" name="_apop_search_order_param[modified][use]" value="1">
|
|
||||||
<b>更新日</b>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label><input class="apop_search_order_param" type="radio"
|
|
||||||
name="_apop_search_order_param[modified][sort]"
|
|
||||||
value="1">昇順</label>
|
|
||||||
|
|
||||||
<label><input class="apop_search_order_param" type="radio"
|
|
||||||
name="_apop_search_order_param[modified][sort]"
|
|
||||||
value="2">降順</label>
|
|
||||||
<input type="hidden" class="list_order"
|
|
||||||
name="_apop_search_order_param[post_sort][modified]"
|
|
||||||
value="">
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="search_sort_box">
|
<div class="normal_sort_box">
|
||||||
|
<?php echo APOP_UI::none_registerd_alert_msg(); ?>
|
||||||
<ul class="post-order-list">
|
<ul class="post-order-list">
|
||||||
<?php foreach ( $search_lists as $i => $search_list ): $search_order = $i + 1; ?>
|
<?php foreach ( $normal_lists as $i => $normal_list ): $normal_order = $i + 1; ?>
|
||||||
<?php $exclude_posts[] = $search_list->ID; ?>
|
<?php $exclude_posts[] = $normal_list->ID; ?>
|
||||||
<li class="product-list">
|
<li class="product-list">
|
||||||
<span class="sort-num-label"><?php echo $search_order; ?></span>
|
<span class="sort-num-label"><?php echo $normal_order; ?></span>
|
||||||
<?php echo $search_list->post_title; ?>
|
<?php echo $normal_list->post_title; ?>
|
||||||
<input type="hidden" class="list_order"
|
<input type="hidden" class="list_order"
|
||||||
name="_apop_post_search[post_sort][<?php echo $search_list->ID; ?>]"
|
name="_apop_post_normal[post_sort][<?php echo $normal_list->ID; ?>]"
|
||||||
value="<?php echo $search_order; ?>">
|
value="<?php echo $normal_order; ?>">
|
||||||
</li>
|
</li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php $search_none_lists = APOP_UI::get_all_search_posts( 'none', $exclude_posts ); ?>
|
<?php $search_none_lists = APOP_UI::get_all_search_normal_posts( 'none', 'normal', $exclude_posts ); ?>
|
||||||
<?php $search_order = $search_order ?? 0; ?>
|
<?php $normal_order = $normal_order ?? 0; ?>
|
||||||
<?php foreach ( $search_none_lists as $i => $search_list ): $search_order = $search_order + $i + 1; ?>
|
<?php foreach ( $search_none_lists as $i => $search_list ): $normal_order = $normal_order + $i + 1; ?>
|
||||||
<li class="product-list no_order">
|
<li class="product-list no_order">■
|
||||||
<span class="sort-num-label"><?php echo $search_order; ?></span>
|
<span class="sort-num-label"><?php echo $normal_order; ?></span>
|
||||||
<?php echo $search_list->post_title; ?>
|
<?php echo $search_list->post_title; ?>
|
||||||
<input type="hidden" class="list_order"
|
<input type="hidden" class="list_order"
|
||||||
name="_apop_post_search[post_sort][<?php echo $search_list->ID; ?>]"
|
name="_apop_post_normal[post_sort][<?php echo $search_list->ID; ?>]"
|
||||||
value="<?php echo $search_order; ?>">
|
value="<?php echo $normal_order; ?>">
|
||||||
</li>
|
</li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -145,33 +79,69 @@ $apop_search_order = get_option( '_apop_search_order' ) ?? '1';
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="post-order-box">
|
<div class="post-order-box">
|
||||||
<?php foreach ( $category_lists as $tax_key => $tax_list ) : ?>
|
|
||||||
<div class="list-orders-outer">
|
<div class="list-orders-outer">
|
||||||
<?php if ( count( $tax_list ) > 0 ): $exclude_posts = []; ?>
|
<?php $exclude_posts = []; ?>
|
||||||
<?php foreach ( $tax_list as $tax_data ): ?>
|
<div class="list-orders-inner search_inner">
|
||||||
<div class="list-orders-inner">
|
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
<?php wp_nonce_field( 'sh_options' ); ?>
|
<?php wp_nonce_field( 'sh_options' ); ?>
|
||||||
<h3><?php echo $tax_data->name; ?></h3>
|
<ul class="apop_search_order_target"
|
||||||
<ul class="post-order-list">
|
data-search_order_target="<?php echo $apop_search_order_check; ?>">
|
||||||
<?php
|
<li><label>
|
||||||
list( $product_order_list, $exclude_posts, $sort_num ) = APOP_UI::create_order_list( $tax_data, $tax_key, $exclude_posts );
|
<input class="apop_search_order" type="radio" name="_apop_search_order"
|
||||||
echo $product_order_list;
|
value="1"<?php checked( $apop_search_order_check, 1 ); ?>>標準</label></li>
|
||||||
echo APOP_UI::create_product_none_order_list( $tax_data, $tax_key, $exclude_posts, $sort_num );
|
<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>
|
</ul>
|
||||||
|
<hr>
|
||||||
|
<div class="search_sort_box">
|
||||||
|
<?php list( $list, $alert ) = APOP_UI::create_search_normal_list( 'search' ); ?>
|
||||||
|
<?php echo $alert; ?>
|
||||||
|
<ul class="post-order-list search_normal_sort">
|
||||||
|
<?php echo $list; ?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="search_sort_box">
|
||||||
|
<?php echo APOP_UI::none_registerd_alert_msg(); ?>
|
||||||
|
<ul class="post-order-list">
|
||||||
|
<?php foreach ( $search_lists as $i => $search_list ): $search_order = $i + 1; ?>
|
||||||
|
<?php $exclude_posts[] = $search_list->ID; ?>
|
||||||
|
<li class="product-list">
|
||||||
|
<span class="sort-num-label"><?php echo $search_order; ?></span>
|
||||||
|
<?php echo $search_list->post_title; ?>
|
||||||
|
<input type="hidden" class="list_order"
|
||||||
|
name="_apop_post_search[post_sort][<?php echo $search_list->ID; ?>]"
|
||||||
|
value="<?php echo $search_order; ?>">
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php $search_none_lists = APOP_UI::get_all_search_normal_posts( 'none', 'search', $exclude_posts ); ?>
|
||||||
|
<?php $search_order = $search_order ?? 0; ?>
|
||||||
|
<?php foreach ( $search_none_lists as $i => $search_list ): $search_order = $search_order + $i + 1; ?>
|
||||||
|
<li class="product-list no_order">■
|
||||||
|
<span class="sort-num-label"><?php echo $search_order; ?></span>
|
||||||
|
<?php echo $search_list->post_title; ?>
|
||||||
|
<input type="hidden" class="list_order"
|
||||||
|
name="_apop_post_search[post_sort][<?php echo $search_list->ID; ?>]"
|
||||||
|
value="<?php echo $search_order; ?>">
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<input type="hidden" name="submit_type" value="1">
|
<input type="hidden" name="submit_type" value="1">
|
||||||
<p class="submit post-order"><input type="submit" name="Submit" class="button-primary"
|
<p class="submit post-order"><input type="submit" name="Submit" class="button-primary"
|
||||||
value="変更を保存"/></p>
|
value="変更を保存"/></p>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="post-order-box">
|
<div class="post-order-box">
|
||||||
<?php foreach ( $tag_lists as $tax_key => $tax_list ) : ?>
|
<?php if ( count( $taxonomy_lists['taxonomy'] ) > 0 ): ?>
|
||||||
|
<?php echo APOP_UI::none_registerd_alert_msg(); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php foreach ( $category_lists as $tax_key => $tax_list ) : ?>
|
||||||
<div class="list-orders-outer">
|
<div class="list-orders-outer">
|
||||||
<?php if ( count( $tax_list ) > 0 ): $exclude_posts = []; ?>
|
<?php if ( count( $tax_list ) > 0 ): $exclude_posts = []; ?>
|
||||||
<?php foreach ( $tax_list as $tax_data ): ?>
|
<?php foreach ( $tax_list as $tax_data ): ?>
|
||||||
@@ -192,11 +162,47 @@ $apop_search_order = get_option( '_apop_search_order' ) ?? '1';
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php echo APOP_UI::create_none_select_msg( 'カテゴリー' ); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="post-order-box">
|
<div class="post-order-box">
|
||||||
|
<?php if ( count( $taxonomy_lists['taxonomy'] ) > 0 ): ?>
|
||||||
|
<?php echo APOP_UI::none_registerd_alert_msg(); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?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>
|
||||||
|
<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>
|
||||||
|
<div class="post-order-box">
|
||||||
|
<?php if ( count( $taxonomy_lists['taxonomy'] ) > 0 ): ?>
|
||||||
|
<?php echo APOP_UI::none_registerd_alert_msg(); ?>
|
||||||
|
<?php endif; ?>
|
||||||
<?php foreach ( $taxonomy_lists as $tax_key => $taxonomy_list ): ?>
|
<?php foreach ( $taxonomy_lists as $tax_key => $taxonomy_list ): ?>
|
||||||
<div class="list-orders-outer">
|
<div class="list-orders-outer">
|
||||||
<?php foreach ( $taxonomy_list as $tax_list ) : ?>
|
<?php foreach ( $taxonomy_list as $tax_list ) : ?>
|
||||||
@@ -213,7 +219,7 @@ $apop_search_order = get_option( '_apop_search_order' ) ?? '1';
|
|||||||
echo APOP_UI::create_product_none_order_list( $tax_data, $tax_key, $exclude_posts, $sort_num );
|
echo APOP_UI::create_product_none_order_list( $tax_data, $tax_key, $exclude_posts, $sort_num );
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
<input type="hidden" name="submit_type" value="3">
|
<input type="hidden" name="submit_type" value="4">
|
||||||
<p class="submit post-order"><input type="submit" name="Submit"
|
<p class="submit post-order"><input type="submit" name="Submit"
|
||||||
class="button-primary"
|
class="button-primary"
|
||||||
value="変更を保存"/></p>
|
value="変更を保存"/></p>
|
||||||
@@ -222,6 +228,9 @@ $apop_search_order = get_option( '_apop_search_order' ) ?? '1';
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
<?php if ( count( $taxonomy_lists['taxonomy'] ) == 0 ): ?>
|
||||||
|
<?php echo APOP_UI::create_none_select_msg( 'カスタム分類' ); ?>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+114
-89
@@ -16,66 +16,48 @@ $all_tax = APOP_UI::get_all_taxonomies( 'taxonomy' );
|
|||||||
<h2>設定</h2>
|
<h2>設定</h2>
|
||||||
<table class="form-table">
|
<table class="form-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">検索</th>
|
<th scope="row">全体設定</th>
|
||||||
<td>
|
<td>
|
||||||
<dl class="post_per_page_list">
|
<dl class="apop_setting_list">
|
||||||
<dt>1ページ表示件数</dt>
|
<dt>1ページ表示件数</dt>
|
||||||
<dd><?php $per_page_data = APOP_UI::create_cat_per_page( $opt_per_page, 'search' ); ?>
|
<dd><?php $per_page_data = APOP_UI::create_cat_per_page( $opt_per_page, 'search' ); ?>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<label>
|
<label>
|
||||||
<input class="per_page_search" type="radio" name="_apop_per_page[search]"
|
<input class="per_page_search" type="radio" name="_apop_per_page[search]"
|
||||||
value="default"<?php echo checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う</label>
|
value="default"<?php checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う</label>
|
||||||
</li>
|
</li>
|
||||||
<li><label>
|
<li><label>
|
||||||
<input class="per_page_search" type="radio" name="_apop_per_page[search]"
|
<input class="per_page_search" type="radio" name="_apop_per_page[search]"
|
||||||
value="-1"<?php echo checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
|
value="-1"<?php checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label><input class="per_page_search" type="radio"
|
<label><input class="per_page_search" type="radio"
|
||||||
name="_apop_per_page[search]"
|
name="_apop_per_page[search]"
|
||||||
value="set"<?php echo $per_page_data['_set']; ?>>表示数設定
|
value=""<?php echo $per_page_data['_checked']; ?>>表示数設定
|
||||||
<input class="per_page_search_input" type="text"
|
<input class="per_page_search_input" type="text"
|
||||||
name="_apop_per_page[search]"
|
name="_apop_per_page[search]"
|
||||||
value="<?php echo $per_page_data['_per_page_num']; ?>" required>
|
value="<?php echo $per_page_data['_per_page_num']; ?>" required>
|
||||||
</label></li>
|
</label>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php if ( count( $all_categories ) > 0 ): ?>
|
<?php if ( count( $all_categories ) > 0 ): $disp = false; ?>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">カテゴリー</th>
|
<th scope="row">カテゴリー設定</th>
|
||||||
<td>
|
<td>
|
||||||
<dl class="post_per_page_list">
|
<dl class="apop_setting_list">
|
||||||
<dt>1ページ表示件数</dt>
|
<dt>対象</dt>
|
||||||
<dd><?php $per_page_data = APOP_UI::create_cat_per_page( $opt_per_page, 'category' ); ?>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<label>
|
|
||||||
<input class="per_page_cat" type="radio" name="_apop_per_page[category]"
|
|
||||||
value="default"<?php echo checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う</label>
|
|
||||||
</li>
|
|
||||||
<li><label>
|
|
||||||
<input class="per_page_cat" type="radio" name="_apop_per_page[category]"
|
|
||||||
value="-1"<?php echo checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label><input class="per_page_cat" type="radio"
|
|
||||||
name="_apop_per_page[category]"
|
|
||||||
value="set"<?php echo $per_page_data['_set']; ?>>表示数設定
|
|
||||||
<input class="per_page_cat_input" type="text"
|
|
||||||
name="_apop_per_page[category]"
|
|
||||||
value="<?php echo $per_page_data['_per_page_num']; ?>" required>
|
|
||||||
</label></li>
|
|
||||||
</ul>
|
|
||||||
</dd>
|
|
||||||
<dt>対象カテゴリー</dt>
|
|
||||||
<dd>
|
<dd>
|
||||||
<ul class="order_setting_list">
|
<ul class="order_setting_list">
|
||||||
<?php foreach ( $all_categories as $category ): ?>
|
<?php foreach ( $all_categories as $category ): ?>
|
||||||
<?php $check_slug = $opt_cat['target_cat'][ $category->term_id ] ?? ''; ?>
|
<?php
|
||||||
|
$check_slug = $opt_cat['target_cat'][ $category->term_id ] ?? '';
|
||||||
|
APOP_UI::is_disp_per_page( $disp, $check_slug );
|
||||||
|
?>
|
||||||
<li>
|
<li>
|
||||||
<div class="select_cat">
|
<div class="select_cat">
|
||||||
<label>
|
<label>
|
||||||
@@ -84,7 +66,7 @@ $all_tax = APOP_UI::get_all_taxonomies( 'taxonomy' );
|
|||||||
value="0">
|
value="0">
|
||||||
<input type="checkbox"
|
<input type="checkbox"
|
||||||
name="_apop_cat_order[target_cat][<?php echo $category->term_id; ?>]"
|
name="_apop_cat_order[target_cat][<?php echo $category->term_id; ?>]"
|
||||||
<?php echo checked( $check_slug, 1 ); ?>
|
<?php checked( $check_slug, 1 ); ?>
|
||||||
value="1">
|
value="1">
|
||||||
<?php echo $category->name; ?>
|
<?php echo $category->name; ?>
|
||||||
</label>
|
</label>
|
||||||
@@ -93,41 +75,51 @@ $all_tax = APOP_UI::get_all_taxonomies( 'taxonomy' );
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt<?php echo APOP_UI::create_disp_class( $disp ); ?>>1ページ表示件数</dt>
|
||||||
|
<dd<?php echo APOP_UI::create_disp_class( $disp ); ?>>
|
||||||
|
<?php $per_page_data = APOP_UI::create_cat_per_page( $opt_per_page, 'category' ); ?>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<label>
|
||||||
|
<input class="per_page_cat" type="radio" name="_apop_per_page[category]"
|
||||||
|
value="default"<?php checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う</label>
|
||||||
|
</li>
|
||||||
|
<li><label>
|
||||||
|
<input class="per_page_cat" type="radio" name="_apop_per_page[category]"
|
||||||
|
value="all"<?php checked( $per_page_data['_per_page'], 'all' ); ?>>全体設定に従う</label>
|
||||||
|
</li>
|
||||||
|
<li><label>
|
||||||
|
<input class="per_page_cat" type="radio" name="_apop_per_page[category]"
|
||||||
|
value="-1"<?php checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label><input class="per_page_cat" type="radio"
|
||||||
|
name="_apop_per_page[category]"
|
||||||
|
value=""<?php echo $per_page_data['_checked']; ?>>表示数設定
|
||||||
|
<input class="per_page_cat_input" type="text"
|
||||||
|
name="_apop_per_page[category]"
|
||||||
|
value="<?php echo $per_page_data['_per_page_num']; ?>" required>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if ( count( $all_tags ) > 0 ): ?>
|
<?php if ( count( $all_tags ) > 0 ): $disp = false; ?>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">タグ</th>
|
<th scope="row">タグ設定</th>
|
||||||
<td>
|
<td>
|
||||||
<dl class="post_per_page_list">
|
<dl class="apop_setting_list">
|
||||||
<dt>1ページ表示件数</dt>
|
<dt>対象</dt>
|
||||||
<dd><?php $per_page_data = APOP_UI::create_cat_per_page( $opt_per_page, 'tag' ); ?>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<label>
|
|
||||||
<input class="per_page_tag" type="radio" name="_apop_per_page[tag]"
|
|
||||||
value="default"<?php echo checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う</label>
|
|
||||||
</li>
|
|
||||||
<li><label>
|
|
||||||
<input class="per_page_tag" type="radio" name="_apop_per_page[tag]"
|
|
||||||
value="-1"<?php echo checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label><input class="per_page_tag" type="radio" name="_apop_per_page[tag]"
|
|
||||||
value="set"<?php echo $per_page_data['_set']; ?>>表示数設定
|
|
||||||
<input class="per_page_tag_input" type="text"
|
|
||||||
name="_apop_per_page[tag]"
|
|
||||||
value="<?php echo $per_page_data['_per_page_num']; ?>" required>
|
|
||||||
</label></li>
|
|
||||||
</ul>
|
|
||||||
</dd>
|
|
||||||
<dt>対象タグ</dt>
|
|
||||||
<dd>
|
<dd>
|
||||||
<ul class="order_setting_list">
|
<ul class="order_setting_list">
|
||||||
<?php foreach ( $all_tags as $tag ): ?>
|
<?php foreach ( $all_tags as $tag ): ?>
|
||||||
<?php $check_slug = $opt_tag['target_cat'][ $tag->term_id ] ?? ''; ?>
|
<?php
|
||||||
|
$check_slug = $opt_tag['target_cat'][ $tag->term_id ] ?? '';
|
||||||
|
APOP_UI::is_disp_per_page( $disp, $check_slug );
|
||||||
|
?>
|
||||||
<li>
|
<li>
|
||||||
<div class="select_cat">
|
<div class="select_cat">
|
||||||
<label>
|
<label>
|
||||||
@@ -136,7 +128,7 @@ $all_tax = APOP_UI::get_all_taxonomies( 'taxonomy' );
|
|||||||
value="0">
|
value="0">
|
||||||
<input type="checkbox"
|
<input type="checkbox"
|
||||||
name="_apop_tag_order[target_cat][<?php echo $tag->term_id; ?>]"
|
name="_apop_tag_order[target_cat][<?php echo $tag->term_id; ?>]"
|
||||||
<?php echo checked( $check_slug, 1 ); ?>
|
<?php checked( $check_slug, 1 ); ?>
|
||||||
value="1">
|
value="1">
|
||||||
<?php echo $tag->name; ?>
|
<?php echo $tag->name; ?>
|
||||||
</label>
|
</label>
|
||||||
@@ -145,44 +137,51 @@ $all_tax = APOP_UI::get_all_taxonomies( 'taxonomy' );
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt<?php echo APOP_UI::create_disp_class( $disp ); ?>>1ページ表示件数</dt>
|
||||||
|
<dd<?php echo APOP_UI::create_disp_class( $disp ); ?>><?php $per_page_data = APOP_UI::create_cat_per_page( $opt_per_page, 'tag' ); ?>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<label>
|
||||||
|
<input class="per_page_tag" type="radio" name="_apop_per_page[tag]"
|
||||||
|
value="default"<?php checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う</label>
|
||||||
|
</li>
|
||||||
|
<li><label>
|
||||||
|
<input class="per_page_tag" type="radio" name="_apop_per_page[tag]"
|
||||||
|
value="all"<?php checked( $per_page_data['_per_page'], 'all' ); ?>>全体設定に従う</label>
|
||||||
|
</li>
|
||||||
|
<li><label>
|
||||||
|
<input class="per_page_tag" type="radio" name="_apop_per_page[tag]"
|
||||||
|
value="-1"<?php checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label><input class="per_page_tag" type="radio" name="_apop_per_page[tag]"
|
||||||
|
value=""<?php echo $per_page_data['_checked']; ?>>表示数設定
|
||||||
|
<input class="per_page_tag_input" type="text"
|
||||||
|
name="_apop_per_page[tag]"
|
||||||
|
value="<?php echo $per_page_data['_per_page_num']; ?>" required>
|
||||||
|
</label></li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if ( count( $all_tax ) > 0 ): ?>
|
<?php
|
||||||
|
if ( count( $all_tax ) > 0 ): $disp = false; ?>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">カスタム分類</th>
|
<th scope="row">カスタム分類</th>
|
||||||
<td>
|
<td>
|
||||||
<dl class="post_per_page_list">
|
<dl class="apop_setting_list">
|
||||||
<dt>1ページ表示件数</dt>
|
<dt>対象</dt>
|
||||||
<dd>
|
|
||||||
<?php $per_page_data = APOP_UI::create_cat_per_page( $opt_per_page, 'tax' ); ?>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<label>
|
|
||||||
<input class="per_page_tax" type="radio" name="_apop_per_page[tax]"
|
|
||||||
value="default"<?php echo checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う</label>
|
|
||||||
</li>
|
|
||||||
<li><label>
|
|
||||||
<input class="per_page_tax" type="radio" name="_apop_per_page[tax]"
|
|
||||||
value="-1"<?php echo checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label><input class="per_page_tax" type="radio" name="_apop_per_page[tax]"
|
|
||||||
value="set"<?php echo $per_page_data['_set']; ?>>表示数設定
|
|
||||||
<input class="per_page_tax_input" type="text"
|
|
||||||
name="_apop_per_page[tax]"
|
|
||||||
value="<?php echo $per_page_data['_per_page_num']; ?>" required>
|
|
||||||
</label></li>
|
|
||||||
</ul>
|
|
||||||
</dd>
|
|
||||||
<dt>対象タクソノミー</dt>
|
|
||||||
<dd>
|
<dd>
|
||||||
<ul class="order_setting_list">
|
<ul class="order_setting_list">
|
||||||
<?php foreach ( $all_tax as $tax ): $all_taxs = APOP_UI::get_all_taxonomies( $tax ) ?>
|
<?php foreach ( $all_tax as $tax ): $all_taxs = APOP_UI::get_all_taxonomies( $tax ); ?>
|
||||||
<?php foreach ( $all_taxs as $tax ): ?>
|
<?php foreach ( $all_taxs as $tax ): ?>
|
||||||
<?php $check_slug = $opt_tax['target_cat'][ $tax->term_id ] ?? ''; ?>
|
<?php
|
||||||
|
$check_slug = $opt_tax['target_cat'][ $tax->term_id ] ?? '';
|
||||||
|
APOP_UI::is_disp_per_page( $disp, $check_slug );
|
||||||
|
?>
|
||||||
<li>
|
<li>
|
||||||
<div class="select_cat">
|
<div class="select_cat">
|
||||||
<label>
|
<label>
|
||||||
@@ -191,7 +190,7 @@ $all_tax = APOP_UI::get_all_taxonomies( 'taxonomy' );
|
|||||||
value="0">
|
value="0">
|
||||||
<input type="checkbox"
|
<input type="checkbox"
|
||||||
name="_apop_tax_order[target_cat][<?php echo $tax->term_id; ?>]"
|
name="_apop_tax_order[target_cat][<?php echo $tax->term_id; ?>]"
|
||||||
<?php echo checked( $check_slug, 1 ); ?>
|
<?php checked( $check_slug, 1 ); ?>
|
||||||
value="1">
|
value="1">
|
||||||
<?php echo $tax->name; ?>
|
<?php echo $tax->name; ?>
|
||||||
</label>
|
</label>
|
||||||
@@ -201,6 +200,32 @@ $all_tax = APOP_UI::get_all_taxonomies( 'taxonomy' );
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt<?php echo APOP_UI::create_disp_class( $disp ); ?>>1ページ表示件数</dt>
|
||||||
|
<dd<?php echo APOP_UI::create_disp_class( $disp ); ?>>
|
||||||
|
<?php $per_page_data = APOP_UI::create_cat_per_page( $opt_per_page, 'tax' ); ?>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<label>
|
||||||
|
<input class="per_page_tax" type="radio" name="_apop_per_page[tax]"
|
||||||
|
value="default"<?php checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う</label>
|
||||||
|
</li>
|
||||||
|
<li><label>
|
||||||
|
<input class="per_page_tax" type="radio" name="_apop_per_page[tax]"
|
||||||
|
value="all"<?php checked( $per_page_data['_per_page'], 'all' ); ?>>全体設定に従う</label>
|
||||||
|
</li>
|
||||||
|
<li><label>
|
||||||
|
<input class="per_page_tax" type="radio" name="_apop_per_page[tax]"
|
||||||
|
value="-1"<?php checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label><input class="per_page_tax" type="radio" name="_apop_per_page[tax]"
|
||||||
|
value=""<?php echo $per_page_data['_checked']; ?>>表示数設定
|
||||||
|
<input class="per_page_tax_input" type="text"
|
||||||
|
name="_apop_per_page[tax]"
|
||||||
|
value="<?php echo $per_page_data['_per_page_num']; ?>" required>
|
||||||
|
</label></li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// WP_UNINSTALL_PLUGINが定義されているかチェック
|
||||||
|
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
//通常と検索の表示件数、ソート対象設定等を削除
|
||||||
|
$param_settings = array(
|
||||||
|
'_apop_per_page',
|
||||||
|
'_apop_normal_order',
|
||||||
|
'_apop_search_order',
|
||||||
|
'_apop_normal_order_param',
|
||||||
|
'_apop_search_order_param',
|
||||||
|
);
|
||||||
|
foreach ( $param_settings as $param_setting ) {
|
||||||
|
delete_option( $param_setting );
|
||||||
|
}
|
||||||
|
|
||||||
|
//通常と検索用のカスタム表示順を削除
|
||||||
|
$option_orders = array(
|
||||||
|
'_apop_post_normal',
|
||||||
|
'_apop_post_search',
|
||||||
|
);
|
||||||
|
foreach ( $option_orders as $option_order ) {
|
||||||
|
delete_post_meta_by_key( $option_order );
|
||||||
|
}
|
||||||
|
|
||||||
|
//タクソノミー設定を削除
|
||||||
|
$tax_order_settings = array(
|
||||||
|
'_apop_cat_order' => '_apop_post_category_',
|
||||||
|
'_apop_tax_order' => '_apop_post_tax_',
|
||||||
|
'_apop_tag_order' => '_apop_post_post_tag_',
|
||||||
|
|
||||||
|
);
|
||||||
|
foreach ( $tax_order_settings as $post_option => $post_meta ) {
|
||||||
|
$target_tax = get_option( $post_option );
|
||||||
|
foreach ( $target_tax['target_cat'] as $tax_id => $status ) {
|
||||||
|
delete_post_meta_by_key( $post_meta . $tax_id );
|
||||||
|
}
|
||||||
|
delete_option( $post_option );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+61
-15
@@ -18,30 +18,26 @@ if ( ! trait_exists( 'APOP_ORDER_SETTING' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( is_home() ) {
|
if ( is_home() ) {
|
||||||
return;
|
$this->set_search_normal_orderby( $query, 'normal' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is_search() ) {
|
if ( is_search() ) {
|
||||||
$this->set_per_page( $query, 'search' );
|
$this->set_search_normal_orderby( $query, 'normal' );
|
||||||
$this->set_search_orderby( $query );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is_category() ) {
|
if ( is_category() ) {
|
||||||
$cat = get_category_by_slug( $query->query_vars['category_name'] );
|
$cat = get_category_by_slug( $query->query_vars['category_name'] );
|
||||||
$this->set_per_page( $query, 'category' );
|
|
||||||
$this->set_orderby( $query, $cat->term_id, 'category', 'cat' );
|
$this->set_orderby( $query, $cat->term_id, 'category', 'cat' );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is_tag() ) {
|
if ( is_tag() ) {
|
||||||
$tag = get_term_by( 'slug', $query->query_vars['tag'], 'post_tag' );
|
$tag = get_term_by( 'slug', $query->query_vars['tag'], 'post_tag' );
|
||||||
$this->set_per_page( $query, 'tag' );
|
|
||||||
$this->set_orderby( $query, $tag->term_id, 'post_tag', 'tag' );
|
$this->set_orderby( $query, $tag->term_id, 'post_tag', 'tag' );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is_tax() ) {
|
if ( is_tax() ) {
|
||||||
$this->set_per_page( $query, 'tax' );
|
|
||||||
$this->set_orderby( $query, get_queried_object_id(), 'tax', 'tax' );
|
$this->set_orderby( $query, get_queried_object_id(), 'tax', 'tax' );
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -55,16 +51,36 @@ if ( ! trait_exists( 'APOP_ORDER_SETTING' ) ) {
|
|||||||
if ( $per_page_option[ $target ] == 'default' ) {
|
if ( $per_page_option[ $target ] == 'default' ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ( $per_page_option[ $target ] == 'all' ) {
|
||||||
|
$target = 'search';
|
||||||
|
}
|
||||||
|
|
||||||
$query->set( 'posts_per_page', $per_page_option[ $target ] );
|
$query->set( 'posts_per_page', $per_page_option[ $target ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
private function set_search_orderby( $query ) {
|
private function set_search_normal_orderby( $query, $type ) {
|
||||||
$apop_search_order = get_option( '_apop_search_order' ) ?? 1;
|
$apop_order = get_option( '_apop_' . $type . '_order' ) ?? 1;
|
||||||
if ( $apop_search_order == 2 ) {
|
if ( $apop_order == 2 ) {
|
||||||
$query->set( 'meta_key', '_apop_post_search' );
|
$query->set( 'meta_key', '_apop_post_' . $type );
|
||||||
$query->set( 'orderby', array( 'meta_value_num' => 'ASC' ) );
|
$query->set( 'orderby', array( 'meta_value_num' => 'ASC' ) );
|
||||||
|
} else {
|
||||||
|
$apop_order_param = get_option( '_apop_' . $type . '_order_param' );
|
||||||
|
$sort_param = array( 1 => 'ASC', 2 => 'DESC' );
|
||||||
|
if ( ! $apop_order_param ) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
foreach ( $apop_order_param as $order_col => $orders ) {
|
||||||
|
if ( $orders['use'] == 1 ) {
|
||||||
|
$orderby[ $order_col ] = $sort_param[ $orders['sort'] ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( isset( $orderby ) ) {
|
||||||
|
$query->set(
|
||||||
|
'orderby', $orderby
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set_per_page( $query, 'search' );
|
||||||
}
|
}
|
||||||
|
|
||||||
private function set_orderby( $query, $id, $target, $order_key ) {
|
private function set_orderby( $query, $id, $target, $order_key ) {
|
||||||
@@ -73,10 +89,39 @@ if ( ! trait_exists( 'APOP_ORDER_SETTING' ) ) {
|
|||||||
$sort_meta_key = '_apop_post_' . $target . '_' . $id;
|
$sort_meta_key = '_apop_post_' . $target . '_' . $id;
|
||||||
$query->set( 'meta_key', $sort_meta_key );
|
$query->set( 'meta_key', $sort_meta_key );
|
||||||
$query->set( 'orderby', array( 'meta_value_num' => 'ASC' ) );
|
$query->set( 'orderby', array( 'meta_value_num' => 'ASC' ) );
|
||||||
|
$target = 'post_tag' ? 'tag' : $target;
|
||||||
|
$this->set_per_page( $query, $target );
|
||||||
|
} else {
|
||||||
|
self::set_search_normal_orderby( $query, 'normal' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function get_orderby( $id, $target, $order_key ): ?array {
|
public static function get_normal_orderby() {
|
||||||
|
$apop_order = get_option( '_apop_normal_order' ) ?? 1;
|
||||||
|
if ( $apop_order == 2 ) {
|
||||||
|
return array(
|
||||||
|
'meta_key' => '_apop_post_normal',
|
||||||
|
'orderby' => array( 'meta_value_num' => 'ASC' ),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$apop_order_param = get_option( '_apop_normal_order_param' );
|
||||||
|
$sort_param = array( 1 => 'ASC', 2 => 'DESC' );
|
||||||
|
foreach ( $apop_order_param as $order_col => $orders ) {
|
||||||
|
if ( $orders['use'] == 1 ) {
|
||||||
|
$orderby[ $order_col ] = $sort_param[ $orders['sort'] ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( isset( $orderby ) ) {
|
||||||
|
return array(
|
||||||
|
'orderby' => $orderby,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function get_tax_orderby( $id, $target, $order_key ) {
|
||||||
$order_settings = get_option( '_apop_' . $order_key . '_order' );
|
$order_settings = get_option( '_apop_' . $order_key . '_order' );
|
||||||
if ( isset( $order_settings['target_cat'][ $id ] ) && $order_settings['target_cat'][ $id ] == 1 ) {
|
if ( isset( $order_settings['target_cat'][ $id ] ) && $order_settings['target_cat'][ $id ] == 1 ) {
|
||||||
$sort_meta_key = '_apop_post_' . $target . '_' . $id;
|
$sort_meta_key = '_apop_post_' . $target . '_' . $id;
|
||||||
@@ -85,21 +130,22 @@ if ( ! trait_exists( 'APOP_ORDER_SETTING' ) ) {
|
|||||||
'meta_key' => $sort_meta_key,
|
'meta_key' => $sort_meta_key,
|
||||||
'orderby' => array( 'meta_value_num' => 'ASC' )
|
'orderby' => array( 'meta_value_num' => 'ASC' )
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
return self::get_normal_orderby();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function get_per_page( $target ) {
|
public static function get_per_page( $target ) {
|
||||||
$per_page_option = get_option( '_apop_per_page' );
|
$per_page_option = get_option( '_apop_per_page' );
|
||||||
if ( ! isset( $per_page_option[ $target ] ) ) {
|
if ( ! isset( $per_page_option ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( $per_page_option[ $target ] == 'default' ) {
|
if ( $per_page_option == 'default' ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return array( 'posts_per_page' => $per_page_option[ $target ] );
|
return array( 'posts_per_page' => $per_page_option );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user