WP PLUGIN ソート対象拡張
・通常、検索、タクソノミーにソート用カスタムフィールドの設定入力欄を追加 ・通常と検索にカスタムフィールド検索処理を実装 ・タクソノミーに通常+カスタムフィールドのメニューを追加 ・タクソノミーに通常+カスタムフィールドとドラッグソートの切り替え用ラジオボタンを追加
This commit is contained in:
+44
-8
@@ -7,8 +7,9 @@ jQuery(function ($) {
|
||||
order_list();
|
||||
|
||||
//order type
|
||||
change_search_order();
|
||||
change_normal_order();
|
||||
// change_search_order();
|
||||
// change_normal_order();
|
||||
change_sort_box();
|
||||
|
||||
//Tax select
|
||||
select_tax();
|
||||
@@ -28,7 +29,7 @@ jQuery(function ($) {
|
||||
$('.post-order-nav li:eq(' + submit_type + ')').addClass('en');
|
||||
$('.post-order-box:eq(' + submit_type + ')').show()
|
||||
|
||||
order_nav_list.click(function () {
|
||||
order_nav_list.on('click', function () {
|
||||
if (!$(this).hasClass('en')) {
|
||||
let target_index = $(this).index();
|
||||
order_nav_list.removeClass('en');
|
||||
@@ -69,7 +70,7 @@ jQuery(function ($) {
|
||||
});
|
||||
$('.normal_sort_box:eq(' + default_index + ')').show().find('input').prop('disabled', false);
|
||||
|
||||
s_radio.click(function () {
|
||||
s_radio.on('click', function () {
|
||||
let target_index = $(this).val() - 1;
|
||||
s_box.hide().find('input').each(function () {
|
||||
$(this).prop('disabled', true);
|
||||
@@ -89,7 +90,7 @@ jQuery(function ($) {
|
||||
|
||||
$('.search_sort_box:eq(' + default_index + ')').show().find('input').prop('disabled', false);
|
||||
|
||||
s_radio.click(function () {
|
||||
s_radio.on('click', function () {
|
||||
let target_index = $(this).val() - 1;
|
||||
s_box.hide().find('input').each(function () {
|
||||
$(this).prop('disabled', true);
|
||||
@@ -98,6 +99,41 @@ jQuery(function ($) {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function change_sort_box() {
|
||||
let parent_selector = $('.list-orders-inner');
|
||||
let parent_selector_size = parent_selector.length;
|
||||
let s_radio = $('.sort_menu');
|
||||
let s_box = $('.sort_box');
|
||||
|
||||
s_box.hide().find('input').each(function () {
|
||||
$(this).prop('disabled', true);
|
||||
});
|
||||
|
||||
for (let i = 0; i < parent_selector_size; i++) {
|
||||
let my_target = $('.list-orders-inner:eq(' + i + ')');
|
||||
let default_index = my_target.find('.sort_menu_list').data('order_target') - 1;
|
||||
if (typeof default_index !== "undefined") {
|
||||
my_target.find('.sort_box:eq(' + default_index + ')').show().find('input').prop('disabled', false);
|
||||
} else if (isNaN(default_index)) {
|
||||
my_target.find('.sort_box:eq(0)').show().find('input').prop('disabled', false);
|
||||
}
|
||||
}
|
||||
|
||||
s_radio.on('click', function () {
|
||||
let target_index = $(this).val() - 1;
|
||||
$(this).parents('.list-orders-inner')
|
||||
.find('.sort_box').hide()
|
||||
.find('input').each(function () {
|
||||
$(this).prop('disabled', true);
|
||||
});
|
||||
$(this).parents('.list-orders-inner')
|
||||
.find('.sort_box:eq(' + target_index + ')').show()
|
||||
.find('input').prop('disabled', false);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function select_tax() {
|
||||
let select_cat_checkbox = $('.select_cat_checkbox');
|
||||
let input_chk_size = select_cat_checkbox.length;
|
||||
@@ -112,7 +148,7 @@ jQuery(function ($) {
|
||||
}
|
||||
}
|
||||
|
||||
select_cat_checkbox.click(function () {
|
||||
select_cat_checkbox.on('click', function () {
|
||||
let checked = $(this).prop('checked');
|
||||
if (checked) {
|
||||
$(this).parent().parent().siblings('.select_per_page').show(200);
|
||||
@@ -133,7 +169,7 @@ jQuery(function ($) {
|
||||
per_page_input.prop('disabled', false);
|
||||
}
|
||||
|
||||
per_page_cat.click(function () {
|
||||
per_page_cat.on('click', function () {
|
||||
if ($(this).val() != 'default' && $(this).val() != '-1' && $(this).val() != 'all') {
|
||||
per_page_input.prop('disabled', false);
|
||||
} else {
|
||||
@@ -157,7 +193,7 @@ jQuery(function ($) {
|
||||
}
|
||||
}
|
||||
|
||||
$('.per_page_cat').click(function () {
|
||||
$('.per_page_cat').on('click', function () {
|
||||
if ($(this).hasClass('set_number')) {
|
||||
$(this).siblings('.per_page_cat_input').prop('disabled', false);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user