WP PLUGIN アーカイブページの投稿表示順設定
・タクソノミーの1ページ表示数をタクソノミー毎のなるよう修正 ・タクソノミーの1ページ表示数変更に合わせてJSを修正 ・タクソノミーの1ページ表示数変更に合わせてテンプレートファイル分割 ・バグ修正:タームIDが無い存在しない場合にpre_get_postでセットしないよう修正 ・バグ修正:通常と検索のpre_get_postでメタキー指定が漏れていたので追加 ・バグ修正:カスタムタクソノミーのpre_get_postでメタキー指定が異なっていたので修正
This commit is contained in:
+44
-4
@@ -32,7 +32,7 @@ if ( ! class_exists( 'APOP_UI' ) ) {
|
||||
return implode( PHP_EOL, $list );
|
||||
}
|
||||
|
||||
private static function crate_non_registerd_mark( $no_order ) {
|
||||
private static function crate_non_registerd_mark( $no_order ): string {
|
||||
if ( ! empty( $no_order ) ) {
|
||||
return '■';
|
||||
}
|
||||
@@ -44,6 +44,8 @@ if ( ! class_exists( 'APOP_UI' ) ) {
|
||||
return array(
|
||||
'post_status' => array( 'publish', 'draft' ),
|
||||
'posts_per_page' => - 1,
|
||||
'orderby' => 'meta_value_num',
|
||||
'order' => 'ASC',
|
||||
'meta_query' => array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
@@ -58,13 +60,20 @@ if ( ! class_exists( 'APOP_UI' ) ) {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public static function get_all_taxonomies( $key ) {
|
||||
private static function get_all_taxonomies( $key ) {
|
||||
if ( $key !== 'taxonomy' ) {
|
||||
return get_terms( array( 'taxonomy' => $key, 'get' => 'all' ) );
|
||||
}
|
||||
$all_custom_tax = get_taxonomies( array( 'public' => true, '_builtin' => false ) );
|
||||
$custom_tax_list = [];
|
||||
foreach ( $all_custom_tax as $custom_tax ) {
|
||||
$custom_tax_list = array_merge( $custom_tax_list, get_terms( array(
|
||||
'taxonomy' => $custom_tax,
|
||||
'get' => 'all'
|
||||
) ) );
|
||||
}
|
||||
|
||||
return get_taxonomies( array( 'public' => true, '_builtin' => false ) );
|
||||
return $custom_tax_list;
|
||||
}
|
||||
|
||||
public static function get_cat_tag_list( $target, $key ): array {
|
||||
@@ -221,6 +230,37 @@ value="' . $sort_num . '">
|
||||
);
|
||||
}
|
||||
|
||||
public static function disp_tax_setting( $key, $title, $order_name ) {
|
||||
$tax_data = APOP_UI::get_all_taxonomies( $key );
|
||||
if ( count( $tax_data ) > 0 ) {
|
||||
$order_name = $order_name;
|
||||
$order_tax = $key == 'post_tag' ? 'tag' : $key;
|
||||
echo '<tr><th scope="row">' . $title . '設定</th><td>';
|
||||
include APOP_PLUGIN_PATH . 'template/setting_parts_taxonomy.php';
|
||||
echo '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
public static function create_tax_per_page( $opt_per_page, $type, $id ): array {
|
||||
$cat_per_page = $opt_per_page[ $type ][ $id ] ?? 'default';
|
||||
$checked = '';
|
||||
$cat_per_page_num = '';
|
||||
if ( isset( $opt_per_page[ $type ][ $id ] ) ) {
|
||||
if ( $opt_per_page[ $type ][ $id ] != 'default'
|
||||
&& $opt_per_page[ $type ][ $id ] != '-1'
|
||||
&& $opt_per_page[ $type ][ $id ] != 'all' ) {
|
||||
$checked = ' checked="checked"';
|
||||
$cat_per_page_num = $cat_per_page;
|
||||
}
|
||||
}
|
||||
|
||||
return array(
|
||||
'_per_page' => $cat_per_page,
|
||||
'_checked' => $checked,
|
||||
'_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 );
|
||||
|
||||
Reference in New Issue
Block a user