update_search_normal_sort( $apop_post_normal, 'normal' ); require_once self::TEMPLATE_DIR . 'success.php'; } //------------------------------------- // 検索表示 // ------------------------------------ $apop_search_order = APOP_UI::input_post_filter( '_apop_search_order', 'str' ); $apop_search_order_param = APOP_UI::input_post_filter( '_apop_search_order_param', 'array' ); $apop_post_search = APOP_UI::input_post_filter( '_apop_post_search', 'array' ); if ( $apop_search_order ) { check_admin_referer( 'sh_options' ); update_option( '_apop_search_order', $apop_search_order ); require_once self::TEMPLATE_DIR . 'success.php'; } //表示順設定 if ( $apop_search_order_param ) { check_admin_referer( 'sh_options' ); update_option( '_apop_search_order_param', $apop_search_order_param ); require_once self::TEMPLATE_DIR . 'success.php'; } //カスタム表示順設定 if ( $apop_post_search ) { check_admin_referer( 'sh_options' ); $this->update_search_normal_sort( $apop_post_search, 'search' ); require_once self::TEMPLATE_DIR . 'success.php'; } //------------------------------------- // タクソノミー // ------------------------------------ $tax_sort_type = APOP_UI::input_post_filter( '_apop_tax_sort_type', 'array' ); $apop_tax_order_param = APOP_UI::input_post_filter( '_apop_tax_order_param', 'array' ); $apop_post_category = APOP_UI::input_post_filter( '_apop_post_category', 'array' ); $apop_post_post_tag = APOP_UI::input_post_filter( '_apop_post_post_tag', 'array' ); $apop_post_tax = APOP_UI::input_post_filter( '_apop_post_tax', 'array' ); //カテゴリーのソートタイプ設定 if ( $tax_sort_type ) { check_admin_referer( 'sh_options' ); update_option( '_apop_tax_sort_type', $tax_sort_type ); require_once self::TEMPLATE_DIR . 'success.php'; } //カテゴリーの標準ソートパラメータ if ( $apop_tax_order_param ) { check_admin_referer( 'sh_options' ); update_option( '_apop_tax_order_param', $apop_tax_order_param ); require_once self::TEMPLATE_DIR . 'success.php'; } //カテゴリーの投稿表示順設定 if ( $apop_post_category ) { check_admin_referer( 'sh_options' ); $this->update_post_sort( 'category', $apop_post_category ); require_once self::TEMPLATE_DIR . 'success.php'; } //タグの投稿表示順設定 if ( $apop_post_post_tag ) { check_admin_referer( 'sh_options' ); $this->update_post_sort( 'post_tag', $apop_post_post_tag ); require_once self::TEMPLATE_DIR . 'success.php'; } //カスタム分類の投稿表示順設定 if ( $apop_post_tax ) { check_admin_referer( 'sh_options' ); $this->update_post_sort( 'tax', $apop_post_tax ); require_once self::TEMPLATE_DIR . 'success.php'; } require_once self::TEMPLATE_DIR . 'order.php'; } //投稿表示順の設定 private function update_post_sort( $target, $post_value ) { $posts_sort = $post_value['post_sort']; foreach ( $posts_sort as $cat_id => $posts ) { $sort_key = '_apop_post_' . $target . '_' . $cat_id; foreach ( $posts as $post_id => $sort ) { update_post_meta( $post_id, $sort_key, $sort ); } } } private function update_search_normal_sort( $apop_post_search_normal, $key ) { $posts_sort = $apop_post_search_normal['post_sort']; foreach ( $posts_sort as $post_id => $sort ) { update_post_meta( $post_id, '_apop_post_' . $key, $sort ); } } } }