ARCHIVE POST ORDER PLUS:カスタム投稿アーカイブの追加
カスタム投稿アーカイブ対応 全体設定で「全件」指定時に「全体設定に従う」の設定が反映されないバグの修正
This commit is contained in:
@@ -47,13 +47,17 @@ if ( ! class_exists( 'APOP_POST' ) ) {
|
||||
$this->create_order_field_data( get_option( '_apop_search_order_param' ), 'search' );
|
||||
}
|
||||
|
||||
//カスタム投稿アーカイブソート
|
||||
$this->create_order_custompost_data( get_option( '_apop_custompost_archive_order_param' ) );
|
||||
|
||||
//カテゴリー、タグ、カスタム分類
|
||||
$this->create_order_tax_field_data( get_option( '_apop_tax_order_param' ) );
|
||||
|
||||
$this->labels = array(
|
||||
'normal' => __('Your latest posts', APOP_DOMAIN),
|
||||
'search' => __('Search', APOP_DOMAIN),
|
||||
'tax' => __('Category, Tag, Custom Taxonomy', APOP_DOMAIN),
|
||||
'normal' => __( 'Your latest posts', APOP_DOMAIN ),
|
||||
'search' => __( 'Search', APOP_DOMAIN ),
|
||||
'tax' => __( 'Category, Tag, Custom Taxonomy', APOP_DOMAIN ),
|
||||
'custompost' => __( 'Custom posts archive', APOP_DOMAIN ),
|
||||
);
|
||||
|
||||
require_once self::TEMPLATE_DIR . 'setting_post_custom_field.php';
|
||||
@@ -80,6 +84,29 @@ if ( ! class_exists( 'APOP_POST' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
private function create_order_custompost_data( $param, $update = false ) {
|
||||
global $post_type;
|
||||
//カスタム投稿タイプでないときは処理を抜ける
|
||||
if ( $post_type == 'page' || $post_type == 'post' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$archive_settings = get_option( '_apop_custompost_archive_sort_type' );
|
||||
if ( array_key_exists( $post_type, $archive_settings ) && $archive_settings[ $post_type ] == 2 ) {
|
||||
foreach ( $this->order_param_keys as $order_param_key ) {
|
||||
if ( isset( $param[ $post_type ][ $order_param_key ]['field']['meta_key'] ) &&
|
||||
! empty( $param[ $post_type ][ $order_param_key ]['field']['meta_key'] ) ) {
|
||||
if ( $update ) {
|
||||
$this->name_keys[] = $param[ $post_type ][ $order_param_key ]['field']['meta_key'];
|
||||
} else {
|
||||
$this->custom_field_type['custompost'][] = $param[ $post_type ][ $order_param_key ]['field']['custom_field_type'];
|
||||
$this->order_field['custompost'][] = $param[ $post_type ][ $order_param_key ]['field']['meta_key'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function create_order_tax_field_data( $param, $update = false ) {
|
||||
$term_ids = $this->create_post_term_ids();
|
||||
$sort_types = get_option( '_apop_tax_sort_type' );
|
||||
@@ -144,6 +171,8 @@ if ( ! class_exists( 'APOP_POST' ) ) {
|
||||
$this->create_order_field_data( get_option( '_apop_normal_order_param' ), 'normal', true );
|
||||
//検索ソート
|
||||
$this->create_order_field_data( get_option( '_apop_search_order_param' ), 'search', true );
|
||||
//カスタム投稿アーカイブ
|
||||
$this->create_order_custompost_data( get_option( '_apop_custompost_archive_order_param' ), true );
|
||||
//カテゴリー、タグ、カスタム分類
|
||||
$this->create_order_tax_field_data( get_option( '_apop_tax_order_param' ), true );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user