WP PLUGIN バグ修正(カスタムフィールドの値がない場合)
・配列の初期化書式を書き換え ・ソートのカスタムフィールドを4つに変更 ・ソートのJSでカスタムフィールドをdisabledにしないよう変更
This commit is contained in:
+32
-21
@@ -21,7 +21,7 @@ if ( ! class_exists( 'APOP_UI' ) ) {
|
||||
$meta_key = '_apop_post_' . $key;
|
||||
$args = self::create_search_normal_args( $meta_key );
|
||||
$posts_data = get_posts( $args );
|
||||
$list = [];
|
||||
$list = array();
|
||||
foreach ( $posts_data as $i => $post_data ) {
|
||||
$order = $i + 1;
|
||||
$no_order = self::is_sort_post_registered( $post_data->ID, $meta_key ) ? '' : ' no_order';
|
||||
@@ -67,7 +67,7 @@ if ( ! class_exists( 'APOP_UI' ) ) {
|
||||
return get_terms( array( 'taxonomy' => $key, 'get' => 'all' ) );
|
||||
}
|
||||
$all_custom_tax = get_taxonomies( array( 'public' => true, '_builtin' => false ) );
|
||||
$custom_tax_list = [];
|
||||
$custom_tax_list = array();
|
||||
foreach ( $all_custom_tax as $custom_tax ) {
|
||||
$custom_tax_list = array_merge( $custom_tax_list, get_terms( array(
|
||||
'taxonomy' => $custom_tax,
|
||||
@@ -93,7 +93,7 @@ if ( ! class_exists( 'APOP_UI' ) ) {
|
||||
}
|
||||
|
||||
private static function create_custom_tax_term( $opt ): array {
|
||||
$tax_data = [];
|
||||
$tax_data = array();
|
||||
foreach ( $opt['target_cat'] as $tax_id => $status ) {
|
||||
//フラグが立っているカスタムタクソノミーは情報を取得する
|
||||
if ( $status ) {
|
||||
@@ -137,7 +137,7 @@ if ( ! class_exists( 'APOP_UI' ) ) {
|
||||
|
||||
public static function create_order_list( $tax_data, $tax_key ): string {
|
||||
$return_data = self::get_sort_post_list( $tax_data->term_id, $tax_key, $tax_data->taxonomy );
|
||||
$list = [];
|
||||
$list = array();
|
||||
foreach ( $return_data['data'] as $key => $target_post ) {
|
||||
$sort_num = $key + 1;
|
||||
$no_order = self::is_sort_post_registered( $target_post->ID, $return_data['meta_key'] ) ? '' : ' no_order';
|
||||
@@ -283,11 +283,14 @@ value="' . $sort_num . '">
|
||||
}
|
||||
$target_keys = self::set_search_normal_target_keys( $order_param );
|
||||
$target_values = array(
|
||||
'date' => '登録日',
|
||||
'title' => 'タイトル',
|
||||
'ID' => 'ID',
|
||||
'modified' => '更新日',
|
||||
'custom_field' => 'カスタムフィールド',
|
||||
'date' => '登録日',
|
||||
'title' => 'タイトル',
|
||||
'ID' => 'ID',
|
||||
'modified' => '更新日',
|
||||
'custom_field' => 'カスタムフィールド1',
|
||||
'custom_field_2' => 'カスタムフィールド2',
|
||||
'custom_field_3' => 'カスタムフィールド3',
|
||||
'custom_field_4' => 'カスタムフィールド4',
|
||||
);
|
||||
$list = array();
|
||||
foreach ( $target_keys as $target_key ) {
|
||||
@@ -297,9 +300,9 @@ value="' . $sort_num . '">
|
||||
$alert = $cnv_order_params['alert'];
|
||||
$no_order_class = $cnv_order_params['no_order_class'];
|
||||
$field_metakey_input = '';
|
||||
if ( $target_key == 'custom_field' ) {
|
||||
$meta_key = $cnv_order_params['custom_field']['meta_key'];
|
||||
$value_type = $cnv_order_params['custom_field']['value_type'];
|
||||
if ( strpos( $target_key, 'custom_field' ) !== false ) {
|
||||
$meta_key = $cnv_order_params[ $target_key ]['meta_key'];
|
||||
$value_type = $cnv_order_params[ $target_key ]['value_type'];
|
||||
$field_metakey_input = self::create_custom_field_sort_type( $name_key, $target_key, $meta_key, $value_type );
|
||||
$target_key_check_class = 'custom_field_check';
|
||||
} else {
|
||||
@@ -358,8 +361,8 @@ value="meta_value_num"' . self::set_search_normal_checked( $value_type, 'meta_va
|
||||
'alert' => '<p>並べ替えを登録するには「変更を保存」をクリックしてください。</p>',
|
||||
'no_order_class' => ' no_order',
|
||||
);
|
||||
if ( $target_key == 'custom_field' ) {
|
||||
$param['custom_field'] = array(
|
||||
if ( strpos( $target_key, 'custom_field' ) !== false ) {
|
||||
$param[ $target_key ] = array(
|
||||
'meta_key' => '',
|
||||
'value_type' => 'meta_value',
|
||||
);
|
||||
@@ -372,8 +375,8 @@ value="meta_value_num"' . self::set_search_normal_checked( $value_type, 'meta_va
|
||||
'alert' => ! $order_param[ $target_key ]['use'] ? '<p>並べ替えを登録するには「変更を保存」をクリックしてください。</p>' : '',
|
||||
'no_order_class' => ! $order_param[ $target_key ]['use'] ? ' no_order' : '',
|
||||
);
|
||||
if ( $target_key == 'custom_field' ) {
|
||||
$param['custom_field'] = array(
|
||||
if ( strpos( $target_key, 'custom_field' ) !== false ) {
|
||||
$param[ $target_key ] = array(
|
||||
'meta_key' => $order_param[ $target_key ]['field']['meta_key'] ?? '',
|
||||
'value_type' => $order_param[ $target_key ]['field']['value_type'] ?? 'meta_value',
|
||||
);
|
||||
@@ -399,17 +402,25 @@ value="meta_value_num"' . self::set_search_normal_checked( $value_type, 'meta_va
|
||||
}
|
||||
|
||||
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(
|
||||
$set_keys = array(
|
||||
'date',
|
||||
'title',
|
||||
'ID',
|
||||
'modified',
|
||||
'custom_field'
|
||||
'custom_field',
|
||||
'custom_field_2',
|
||||
'custom_field_3',
|
||||
'custom_field_4',
|
||||
);
|
||||
|
||||
if ( $post_apop_search_order_param ) {
|
||||
$register_keys = array_keys( $post_apop_search_order_param );
|
||||
|
||||
return array_unique( array_merge( $register_keys, $set_keys ) );
|
||||
}
|
||||
|
||||
return $set_keys;
|
||||
}
|
||||
|
||||
private static function set_search_normal_checked( $param, $default ): string {
|
||||
|
||||
Reference in New Issue
Block a user