diff --git a/class/class.apop.apop_ui.php b/class/class.apop.apop_ui.php index 9868580..99e910c 100644 --- a/class/class.apop.apop_ui.php +++ b/class/class.apop.apop_ui.php @@ -17,9 +17,8 @@ if ( ! class_exists( 'APOP_UI' ) ) { public static function get_all_search_normal_posts( $key ) { $meta_key = '_apop_post_' . $key; - $args = self::create_search_normal_args( $meta_key ); + $args = self::create_search_normal_args( $meta_key, $key ); $posts_data = get_posts( $args ); - $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'; @@ -32,8 +31,20 @@ if ( ! class_exists( 'APOP_UI' ) ) { } } - private static function create_search_normal_args( $meta_key ): array { + private static function create_search_normal_args( $meta_key, $key = 'normal' ): array { + $post_type = array( 'post' ); + if ( $key == 'search' ) { + $add_post_type = array_values( get_post_types( array( + 'public' => true, + '_builtin' => false, + ) + ) + ); + $post_type = array_merge( $post_type, $add_post_type ); + } + return array( + 'post_type' => $post_type, 'post_status' => array( 'publish', 'draft' ), 'posts_per_page' => - 1, 'orderby' => 'meta_value_num',