$key, 'get' => 'all' ) ); } return get_taxonomies( array( 'public' => true, '_builtin' => false ) ); } public static function get_tax_name( $tax_key ): string { $tax_names = array( 'category' => 'カテゴリー', 'tag_id' => 'タグ', 'custom_tax' => 'カスタム分類', ); return $tax_names[ $tax_key ]; } public static function get_cat_tag_list( $target, $key ): array { $opt = get_option( '_apop_' . $target . '_order' ); $include = array(); if ( isset( $opt['target_cat'] ) ) { foreach ( $opt['target_cat'] as $tax_id => $check ) { if ( $check ) { $include[] = $tax_id; } } $include_tax = implode( ',', $include ); if ( ! empty( $include_tax ) ) { $args = array( 'taxonomy' => $key, 'hide_empty' => 0, 'include' => $include_tax, ); return get_terms( $args ); } } return array(); } public static function get_sort_post_list( $tax_id, $search_param, $tax_key ) { $args = [ 'post_status' => array( 'publish', 'draft' ), 'posts_per_page' => - 1, $search_param => $tax_id, 'orderby' => 'meta_value_num', 'order' => 'ASC', 'meta_key' => '_apop_post_' . $tax_key . '_' . $tax_id, ]; return get_posts( $args ); } public static function get_none_sort_post_list( $tax_id, $key, $exclude_posts ) { $exclude = implode( ',', $exclude_posts ); $args = [ 'post_status' => array( 'publish', 'draft' ), 'posts_per_page' => - 1, $key => $tax_id, ]; if ( ! empty( $exclude ) ) { $args['exclude'] = $exclude; } return get_posts( $args ); } }