Compare commits
15 Commits
6051380d2c
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| d4e4c772aa | |||
| d8375c5abe | |||
| 49f7d3088c | |||
| 49d6527486 | |||
| 1791cd0ab7 | |||
| 7d3fb10582 | |||
| 6f064eaafa | |||
| 7b67bdf5f4 | |||
| 5fd91acb2e | |||
| f96800dc9e | |||
| bc37f8ac26 | |||
| 8b2c2e520f | |||
| fd93eb9a07 | |||
| f9351fc32f | |||
| 4bc96228bd |
@@ -5,7 +5,7 @@ Plugin URI: https://develop.n-k-y.net/wordpress/wp_plugin/apop/
|
|||||||
Author: NBK45
|
Author: NBK45
|
||||||
Author URI: https://develop.n-k-y.net
|
Author URI: https://develop.n-k-y.net
|
||||||
Description: Archive Post Order Plus は「最新の投稿」「検索結果」「カテゴリー」「タグ」「カスタム分類」の投稿記事の表示順をドラッグで並べ替えて設定するプラグインです。
|
Description: Archive Post Order Plus は「最新の投稿」「検索結果」「カテゴリー」「タグ」「カスタム分類」の投稿記事の表示順をドラッグで並べ替えて設定するプラグインです。
|
||||||
Version: 1.1.7
|
Version: 1.2.1
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Text Domain: ArchivePostOrderPlus
|
Text Domain: ArchivePostOrderPlus
|
||||||
Domain Path: /languages
|
Domain Path: /languages
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ if ( ! class_exists( 'APOP_POST' ) ) {
|
|||||||
$this->create_order_field_data( get_option( '_apop_search_order_param' ), 'search' );
|
$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->create_order_tax_field_data( get_option( '_apop_tax_order_param' ) );
|
||||||
|
|
||||||
@@ -54,6 +57,7 @@ if ( ! class_exists( 'APOP_POST' ) ) {
|
|||||||
'normal' => __( 'Your latest posts', APOP_DOMAIN ),
|
'normal' => __( 'Your latest posts', APOP_DOMAIN ),
|
||||||
'search' => __( 'Search', APOP_DOMAIN ),
|
'search' => __( 'Search', APOP_DOMAIN ),
|
||||||
'tax' => __( 'Category, Tag, Custom Taxonomy', 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';
|
require_once self::TEMPLATE_DIR . 'setting_post_custom_field.php';
|
||||||
@@ -80,6 +84,30 @@ 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 ( $archive_settings && 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 ) {
|
private function create_order_tax_field_data( $param, $update = false ) {
|
||||||
$term_ids = $this->create_post_term_ids();
|
$term_ids = $this->create_post_term_ids();
|
||||||
$sort_types = get_option( '_apop_tax_sort_type' );
|
$sort_types = get_option( '_apop_tax_sort_type' );
|
||||||
@@ -144,6 +172,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_normal_order_param' ), 'normal', true );
|
||||||
//検索ソート
|
//検索ソート
|
||||||
$this->create_order_field_data( get_option( '_apop_search_order_param' ), 'search', 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 );
|
$this->create_order_tax_field_data( get_option( '_apop_tax_order_param' ), true );
|
||||||
}
|
}
|
||||||
|
|||||||
+125
-57
@@ -6,10 +6,11 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
if ( ! class_exists( 'APOP_UI' ) ) {
|
if ( ! class_exists( 'APOP_UI' ) ) {
|
||||||
|
|
||||||
require_once __DIR__ . '/../util/apop-customfield-select.php';
|
require_once __DIR__ . '/../util/apop-customfield-select.php';
|
||||||
|
require_once __DIR__ . '/../util/apop-customposts.php';
|
||||||
|
|
||||||
class APOP_UI {
|
class APOP_UI {
|
||||||
|
|
||||||
use CUSTOMFIELD_SELECT;
|
use CUSTOMFIELD_SELECT, CUSTOMPOSTS;
|
||||||
|
|
||||||
public static function get_order_type( $type ) {
|
public static function get_order_type( $type ) {
|
||||||
$type_data = get_option( $type );
|
$type_data = get_option( $type );
|
||||||
@@ -68,6 +69,17 @@ if ( ! class_exists( 'APOP_UI' ) ) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function get_all_custom_posts(): array {
|
||||||
|
$custom_posts = array_values( get_post_types( array( 'public' => true, '_builtin' => false ) ) );
|
||||||
|
$custom_post_data = array();
|
||||||
|
foreach ( $custom_posts as $custom_post ) {
|
||||||
|
$label = get_post_type_object( $custom_post )->label;
|
||||||
|
$custom_post_data[ $custom_post ] = $label;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $custom_post_data;
|
||||||
|
}
|
||||||
|
|
||||||
private static function get_all_taxonomies( $key ) {
|
private static function get_all_taxonomies( $key ) {
|
||||||
if ( $key !== 'taxonomy' ) {
|
if ( $key !== 'taxonomy' ) {
|
||||||
return get_terms( array( 'taxonomy' => $key, 'get' => 'all' ) );
|
return get_terms( array( 'taxonomy' => $key, 'get' => 'all' ) );
|
||||||
@@ -247,14 +259,46 @@ value="' . esc_html( $sort_num ) . '">
|
|||||||
public static function disp_tax_setting( $key, $title, $order_name ) {
|
public static function disp_tax_setting( $key, $title, $order_name ) {
|
||||||
$tax_data = APOP_UI::get_all_taxonomies( $key );
|
$tax_data = APOP_UI::get_all_taxonomies( $key );
|
||||||
if ( count( $tax_data ) > 0 ) {
|
if ( count( $tax_data ) > 0 ) {
|
||||||
$order_name = $order_name;
|
|
||||||
$order_tax = $key == 'post_tag' ? 'tag' : $key;
|
$order_tax = $key == 'post_tag' ? 'tag' : $key;
|
||||||
echo '<tr><th scope="row">' . esc_html( $title ) . '</th><td>';
|
echo '<tr><th scope="row">' . esc_html( $title ) . '</th><td>';
|
||||||
|
if ( isset( $tax_data, $order_name, $order_tax ) ) {
|
||||||
include APOP_PLUGIN_PATH . 'template/setting_parts_taxonomy.php';
|
include APOP_PLUGIN_PATH . 'template/setting_parts_taxonomy.php';
|
||||||
|
}
|
||||||
echo '</td></tr>';
|
echo '</td></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function disp_customposts_setting( $key, $title, $order_name ) {
|
||||||
|
$custom_post_data = APOP_UI::get_all_custom_posts();
|
||||||
|
if ( count( $custom_post_data ) > 0 ) {
|
||||||
|
echo '<tr><th scope="row">' . esc_html( $title ) . '</th><td>';
|
||||||
|
if ( isset( $custom_post_data, $order_name, $key ) ) {
|
||||||
|
include APOP_PLUGIN_PATH . 'template/setting_parts_customposts.php';
|
||||||
|
}
|
||||||
|
echo '</td></tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function create_custom_posts_per_page( $opt_per_page, $type, $slug ): array {
|
||||||
|
$cat_per_page = $opt_per_page[ $type ][ $slug ] ?? 'default';
|
||||||
|
$checked = '';
|
||||||
|
$cat_per_page_num = '';
|
||||||
|
if ( isset( $opt_per_page[ $type ][ $slug ] ) ) {
|
||||||
|
if ( $opt_per_page[ $type ][ $slug ] != 'default'
|
||||||
|
&& $opt_per_page[ $type ][ $slug ] != '-1'
|
||||||
|
&& $opt_per_page[ $type ][ $slug ] != '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_tax_per_page( $opt_per_page, $type, $id ): array {
|
public static function create_tax_per_page( $opt_per_page, $type, $id ): array {
|
||||||
$cat_per_page = $opt_per_page[ $type ][ $id ] ?? 'default';
|
$cat_per_page = $opt_per_page[ $type ][ $id ] ?? 'default';
|
||||||
$checked = '';
|
$checked = '';
|
||||||
@@ -287,56 +331,7 @@ value="' . esc_html( $sort_num ) . '">
|
|||||||
if ( isset( $order_param_base[ $id ] ) ) {
|
if ( isset( $order_param_base[ $id ] ) ) {
|
||||||
$order_param = $order_param_base[ $id ];
|
$order_param = $order_param_base[ $id ];
|
||||||
}
|
}
|
||||||
$target_keys = self::set_search_normal_target_keys( $order_param );
|
self::create_normal_sort_list( $name_key, $order_param );
|
||||||
$target_values = array(
|
|
||||||
'date' => __( 'Published', APOP_DOMAIN ),
|
|
||||||
'title' => __( 'Post Title', APOP_DOMAIN ),
|
|
||||||
'ID' => 'ID',
|
|
||||||
'modified' => __( 'Modified', APOP_DOMAIN ),
|
|
||||||
'custom_field' => __( 'Custom filed 1', APOP_DOMAIN ),
|
|
||||||
'custom_field_2' => __( 'Custom filed 2', APOP_DOMAIN ),
|
|
||||||
'custom_field_3' => __( 'Custom filed 3', APOP_DOMAIN ),
|
|
||||||
'custom_field_4' => __( 'Custom filed 4', APOP_DOMAIN ),
|
|
||||||
);
|
|
||||||
$list = array();
|
|
||||||
foreach ( $target_keys as $target_key ) {
|
|
||||||
$cnv_order_params = self::set_order_list_param( $order_param, $target_key );
|
|
||||||
$use = $cnv_order_params['use'];
|
|
||||||
$sort = $cnv_order_params['sort'];
|
|
||||||
$no_order_class = $cnv_order_params['no_order_class'];
|
|
||||||
$name_use_key = '_' . $name_key . '[' . $target_key . '][use]';
|
|
||||||
$name_sort_key = '_' . $name_key . '[' . $target_key . '][sort]';
|
|
||||||
if ( strpos( $target_key, 'custom_field' ) !== false ) {
|
|
||||||
$target_key_check_class = 'custom_field_check';
|
|
||||||
} else {
|
|
||||||
$target_key_check_class = 'sort_' . $target_key . '_check';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<li class="product-list' . esc_attr( $no_order_class ) . '">
|
|
||||||
<div class="product-list-type-label"><b>' . esc_attr( $target_values[ $target_key ] ) . '</b></div>
|
|
||||||
<div class="product-list-sort-type">
|
|
||||||
<label>
|
|
||||||
<input type="hidden" name="' . esc_attr( $name_use_key ) . '"
|
|
||||||
value="0"' . esc_attr( self::set_search_normal_checked( $use, 0 ) ) . '>
|
|
||||||
<span class="en_dis_label">' . __( 'Enabled', APOP_DOMAIN ) . '</span>:<input class="' . esc_html( $target_key_check_class ) . '"
|
|
||||||
type="checkbox" name="' . esc_attr( $name_use_key ) . '" value="1"' . esc_attr( self::set_search_normal_checked( $use, 1 ) ) . '>
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
<input class="order_param" type="radio"
|
|
||||||
name="' . esc_attr( $name_sort_key ) . '"
|
|
||||||
value="1"' . esc_attr( self::set_search_normal_checked( $sort, 1 ) ) . '>' . __( 'Asc', APOP_DOMAIN ) . '</label>
|
|
||||||
<label>
|
|
||||||
<input class="order_param" type="radio"
|
|
||||||
name="' . esc_attr( $name_sort_key ) . '"
|
|
||||||
value="2"' . esc_attr( self::set_search_normal_checked( $sort, 2 ) ) . '>' . __( 'Desc', APOP_DOMAIN ) . '</label>';
|
|
||||||
|
|
||||||
if ( strpos( $target_key, 'custom_field' ) !== false ) {
|
|
||||||
self::create_custom_field_sort_type( $name_key, $target_key, $cnv_order_params );
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</div>
|
|
||||||
</li>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function create_custom_field_sort_type( $name_key, $target_key, $cnv_order_params ) {
|
private static function create_custom_field_sort_type( $name_key, $target_key, $cnv_order_params ) {
|
||||||
@@ -347,7 +342,7 @@ value="' . esc_html( $sort_num ) . '">
|
|||||||
$name_value_type = '_' . $name_key . '[' . $target_key . '][field][value_type]';
|
$name_value_type = '_' . $name_key . '[' . $target_key . '][field][value_type]';
|
||||||
$name_custom_field_type = '_' . $name_key . '[' . $target_key . '][field][custom_field_type]';
|
$name_custom_field_type = '_' . $name_key . '[' . $target_key . '][field][custom_field_type]';
|
||||||
$custom_field_val_1 = $custom_field_type == '1' ? $meta_key : '';
|
$custom_field_val_1 = $custom_field_type == '1' ? $meta_key : '';
|
||||||
$custom_field_val_2 = $custom_field_type == '2' ? $meta_key : '';;
|
$custom_field_val_2 = $custom_field_type == '2' ? $meta_key : '';
|
||||||
echo '<div class="sort-custom-field">
|
echo '<div class="sort-custom-field">
|
||||||
<div class="sort-custom-field-types">
|
<div class="sort-custom-field-types">
|
||||||
<div class="sort-custom-field-inner-label">
|
<div class="sort-custom-field-inner-label">
|
||||||
@@ -362,7 +357,7 @@ value="' . esc_html( $sort_num ) . '">
|
|||||||
name="' . esc_attr( $name_custom_field_type ) . '"
|
name="' . esc_attr( $name_custom_field_type ) . '"
|
||||||
value="2"' . esc_attr( self::set_search_normal_checked( $custom_field_type, '2' ) ) . '>' . __( 'Add', APOP_DOMAIN ) . '</label>
|
value="2"' . esc_attr( self::set_search_normal_checked( $custom_field_type, '2' ) ) . '>' . __( 'Add', APOP_DOMAIN ) . '</label>
|
||||||
</div>';
|
</div>';
|
||||||
echo '<input type="text" class="select-custom-field-input custom_field_key_select" name="' . esc_attr( $name_meta_key ) . '" . value="' . esc_attr( $custom_field_val_1 ) . '" required>
|
echo '<input type="text" class="select-custom-field-input custom_field_key_select" name="' . esc_attr( $name_meta_key ) . '" value="' . esc_attr( $custom_field_val_1 ) . '" required>
|
||||||
<input type="text" class="custom_field_key" name="' . esc_attr( $name_meta_key ) . '" value="' . esc_attr( $custom_field_val_2 ) . '" required>
|
<input type="text" class="custom_field_key" name="' . esc_attr( $name_meta_key ) . '" value="' . esc_attr( $custom_field_val_2 ) . '" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="custom-field-select-alert"></div>
|
<div class="custom-field-select-alert"></div>
|
||||||
@@ -430,7 +425,7 @@ value="' . esc_html( $sort_num ) . '">
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function set_search_normal_target_keys( $post_apop_search_order_param ) {
|
private static function set_search_normal_target_keys( $post_apop_search_order_param ): array {
|
||||||
|
|
||||||
$set_keys = array(
|
$set_keys = array(
|
||||||
'date',
|
'date',
|
||||||
@@ -460,12 +455,85 @@ value="' . esc_html( $sort_num ) . '">
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POSTデータのフィルタリングを行います。
|
||||||
|
*
|
||||||
|
* @param string $var_name 取得するPOST変数名。
|
||||||
|
* @param string $type 'array' または 'str' を指定します。
|
||||||
|
*
|
||||||
|
* @return array|string フィルタリングされたPOSTデータ、または失敗した場合は空文字列。
|
||||||
|
*/
|
||||||
public static function input_post_filter( $var_name, $type ) {
|
public static function input_post_filter( $var_name, $type ) {
|
||||||
if ( $type == 'array' ) {
|
if ( $type == 'array' ) {
|
||||||
return filter_input( INPUT_POST, $var_name, FILTER_SANITIZE_STRING, FILTER_REQUIRE_ARRAY );
|
$data = filter_input( INPUT_POST, $var_name, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
|
||||||
|
if ( is_array( $data ) ) {
|
||||||
|
array_walk_recursive( $data, function ( &$value ) {
|
||||||
|
$value = htmlspecialchars( $value, ENT_QUOTES, 'UTF-8' );
|
||||||
|
} );
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
if ( $type == 'str' ) {
|
if ( $type == 'str' ) {
|
||||||
return filter_input( INPUT_POST, $var_name, FILTER_SANITIZE_STRING );
|
$data = filter_input( INPUT_POST, $var_name );
|
||||||
|
if ( $data !== null && $data !== false ) {
|
||||||
|
return htmlspecialchars( $data, ENT_QUOTES, 'UTF-8' );
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function create_normal_sort_list( $name_key, $order_param ) {
|
||||||
|
$target_keys = self::set_search_normal_target_keys( $order_param );
|
||||||
|
$target_values = array(
|
||||||
|
'date' => __( 'Published', APOP_DOMAIN ),
|
||||||
|
'title' => __( 'Post Title', APOP_DOMAIN ),
|
||||||
|
'ID' => 'ID',
|
||||||
|
'modified' => __( 'Modified', APOP_DOMAIN ),
|
||||||
|
'custom_field' => __( 'Custom filed 1', APOP_DOMAIN ),
|
||||||
|
'custom_field_2' => __( 'Custom filed 2', APOP_DOMAIN ),
|
||||||
|
'custom_field_3' => __( 'Custom filed 3', APOP_DOMAIN ),
|
||||||
|
'custom_field_4' => __( 'Custom filed 4', APOP_DOMAIN ),
|
||||||
|
);
|
||||||
|
foreach ( $target_keys as $target_key ) {
|
||||||
|
$cnv_order_params = self::set_order_list_param( $order_param, $target_key );
|
||||||
|
$use = $cnv_order_params['use'];
|
||||||
|
$sort = $cnv_order_params['sort'];
|
||||||
|
$no_order_class = $cnv_order_params['no_order_class'];
|
||||||
|
$name_use_key = '_' . $name_key . '[' . $target_key . '][use]';
|
||||||
|
$name_sort_key = '_' . $name_key . '[' . $target_key . '][sort]';
|
||||||
|
if ( strpos( $target_key, 'custom_field' ) !== false ) {
|
||||||
|
$target_key_check_class = 'custom_field_check';
|
||||||
|
} else {
|
||||||
|
$target_key_check_class = 'sort_' . $target_key . '_check';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<li class="product-list' . esc_attr( $no_order_class ) . '">
|
||||||
|
<div class="product-list-type-label"><b>' . esc_attr( $target_values[ $target_key ] ) . '</b></div>
|
||||||
|
<div class="product-list-sort-type">
|
||||||
|
<label>
|
||||||
|
<input type="hidden" name="' . esc_attr( $name_use_key ) . '"
|
||||||
|
value="0"' . esc_attr( self::set_search_normal_checked( $use, 0 ) ) . '>
|
||||||
|
<span class="en_dis_label">' . __( 'Enabled', APOP_DOMAIN ) . '</span>:<input class="' . esc_html( $target_key_check_class ) . '"
|
||||||
|
type="checkbox" name="' . esc_attr( $name_use_key ) . '" value="1"' . esc_attr( self::set_search_normal_checked( $use, 1 ) ) . '>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input class="order_param" type="radio"
|
||||||
|
name="' . esc_attr( $name_sort_key ) . '"
|
||||||
|
value="1"' . esc_attr( self::set_search_normal_checked( $sort, 1 ) ) . '>' . __( 'Asc', APOP_DOMAIN ) . '</label>
|
||||||
|
<label>
|
||||||
|
<input class="order_param" type="radio"
|
||||||
|
name="' . esc_attr( $name_sort_key ) . '"
|
||||||
|
value="2"' . esc_attr( self::set_search_normal_checked( $sort, 2 ) ) . '>' . __( 'Desc', APOP_DOMAIN ) . '</label>';
|
||||||
|
|
||||||
|
if ( strpos( $target_key, 'custom_field' ) !== false ) {
|
||||||
|
self::create_custom_field_sort_type( $name_key, $target_key, $cnv_order_params );
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</div>
|
||||||
|
</li>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+82
-18
@@ -7,10 +7,13 @@ if ( ! class_exists( 'APOP' ) ) {
|
|||||||
|
|
||||||
require_once __DIR__ . '/../util/apop-order-setting.php';
|
require_once __DIR__ . '/../util/apop-order-setting.php';
|
||||||
require_once __DIR__ . '/../util/apop-customfield-select.php';
|
require_once __DIR__ . '/../util/apop-customfield-select.php';
|
||||||
|
require_once __DIR__ . '/../util/apop-customposts.php';
|
||||||
|
require_once __DIR__ . '/../util/apop-tax.php';
|
||||||
|
require_once __DIR__ . '/../util/apop-output.php';
|
||||||
|
|
||||||
class APOP {
|
class APOP {
|
||||||
|
|
||||||
use APOP_ORDER_SETTING, CUSTOMFIELD_SELECT;
|
use APOP_ORDER_SETTING, CUSTOMFIELD_SELECT, CUSTOMPOSTS, TAX, APOP_OUTPUT;
|
||||||
|
|
||||||
const TEMPLATE_DIR = __DIR__ . '/../template/';
|
const TEMPLATE_DIR = __DIR__ . '/../template/';
|
||||||
|
|
||||||
@@ -55,6 +58,7 @@ if ( ! class_exists( 'APOP' ) ) {
|
|||||||
'_apop_per_page', //1ページ表示件数
|
'_apop_per_page', //1ページ表示件数
|
||||||
'_apop_tag_order', //タグ設定
|
'_apop_tag_order', //タグ設定
|
||||||
'_apop_tax_order', //カスタムタクソノミー設定
|
'_apop_tax_order', //カスタムタクソノミー設定
|
||||||
|
'_apop_custompost_archive_order', //カスタム投稿設定
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ( $settings as $setting ) {
|
foreach ( $settings as $setting ) {
|
||||||
@@ -72,9 +76,26 @@ if ( ! class_exists( 'APOP' ) ) {
|
|||||||
|
|
||||||
|
|
||||||
public function show_option_page() {
|
public function show_option_page() {
|
||||||
//-------------------------------------
|
|
||||||
//最新の投稿表示
|
//最新の投稿表示
|
||||||
// ------------------------------------
|
$this->set_new_lists();
|
||||||
|
|
||||||
|
// 検索表示
|
||||||
|
$this->set_search_lists();
|
||||||
|
|
||||||
|
// カスタム投稿アーカイブ
|
||||||
|
$this->set_custompost_archive_list();
|
||||||
|
|
||||||
|
// タクソノミー
|
||||||
|
$this->set_tax_list();
|
||||||
|
|
||||||
|
require_once self::TEMPLATE_DIR . 'order.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------
|
||||||
|
// 最新の投稿表示
|
||||||
|
//---------------------------------------------------------------------------------
|
||||||
|
private function set_new_lists() {
|
||||||
$apop_normal_order = APOP_UI::input_post_filter( '_apop_normal_order', 'str' );
|
$apop_normal_order = APOP_UI::input_post_filter( '_apop_normal_order', 'str' );
|
||||||
$apop_normal_order_param = APOP_UI::input_post_filter( '_apop_normal_order_param', 'array' );
|
$apop_normal_order_param = APOP_UI::input_post_filter( '_apop_normal_order_param', 'array' );
|
||||||
$apop_post_normal = APOP_UI::input_post_filter( '_apop_post_normal', 'array' );
|
$apop_post_normal = APOP_UI::input_post_filter( '_apop_post_normal', 'array' );
|
||||||
@@ -98,10 +119,12 @@ if ( ! class_exists( 'APOP' ) ) {
|
|||||||
$this->update_search_normal_sort( $apop_post_normal, 'normal' );
|
$this->update_search_normal_sort( $apop_post_normal, 'normal' );
|
||||||
require_once self::TEMPLATE_DIR . 'success.php';
|
require_once self::TEMPLATE_DIR . 'success.php';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
// 検索表示
|
// 検索結果
|
||||||
// ------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
|
private function set_search_lists() {
|
||||||
$apop_search_order = APOP_UI::input_post_filter( '_apop_search_order', 'str' );
|
$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_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' );
|
$apop_post_search = APOP_UI::input_post_filter( '_apop_post_search', 'array' );
|
||||||
@@ -125,10 +148,60 @@ if ( ! class_exists( 'APOP' ) ) {
|
|||||||
$this->update_search_normal_sort( $apop_post_search, 'search' );
|
$this->update_search_normal_sort( $apop_post_search, 'search' );
|
||||||
require_once self::TEMPLATE_DIR . 'success.php';
|
require_once self::TEMPLATE_DIR . 'success.php';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------
|
//検索結果と最近の投稿の表示順の保存
|
||||||
|
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 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------
|
||||||
|
// カスタム投稿アーカイブ
|
||||||
|
//---------------------------------------------------------------------------------
|
||||||
|
private function set_custompost_archive_list() {
|
||||||
|
$custompost_archive_sort_type = APOP_UI::input_post_filter( '_apop_custompost_archive_sort_type', 'array' );
|
||||||
|
$apop_custompost_archive_order_param = APOP_UI::input_post_filter( '_apop_custompost_archive_order_param', 'array' );
|
||||||
|
$apop_custompost_archive = APOP_UI::input_post_filter( '_apop_customposts', 'array' );
|
||||||
|
|
||||||
|
//カスタム投稿アーカイブのソートタイプ設定
|
||||||
|
if ( $custompost_archive_sort_type ) {
|
||||||
|
check_admin_referer( 'sh_options' );
|
||||||
|
update_option( '_apop_custompost_archive_sort_type', $custompost_archive_sort_type );
|
||||||
|
require_once self::TEMPLATE_DIR . 'success.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
//カスタム投稿アーカイブの標準ソートパラメータ
|
||||||
|
if ( $apop_custompost_archive_order_param ) {
|
||||||
|
check_admin_referer( 'sh_options' );
|
||||||
|
update_option( '_apop_custompost_archive_order_param', $apop_custompost_archive_order_param );
|
||||||
|
require_once self::TEMPLATE_DIR . 'success.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
//カスタム投稿アーカイブの投稿表示順設定
|
||||||
|
if ( $apop_custompost_archive ) {
|
||||||
|
check_admin_referer( 'sh_options' );
|
||||||
|
$this->update_custom_post_sort( $apop_custompost_archive );
|
||||||
|
require_once self::TEMPLATE_DIR . 'success.php';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//カスタム投稿アーカイブ表示順の保存
|
||||||
|
private function update_custom_post_sort( $post_value ) {
|
||||||
|
foreach ( $post_value as $custom_post_type => $posts ) {
|
||||||
|
foreach ( $posts as $post_id => $sort ) {
|
||||||
|
$sort_key = '_apop_customposts_' . $custom_post_type;
|
||||||
|
update_post_meta( $post_id, $sort_key, $sort );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------
|
||||||
// タクソノミー
|
// タクソノミー
|
||||||
// ------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
|
private function set_tax_list() {
|
||||||
$tax_sort_type = APOP_UI::input_post_filter( '_apop_tax_sort_type', 'array' );
|
$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_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_category = APOP_UI::input_post_filter( '_apop_post_category', 'array' );
|
||||||
@@ -169,11 +242,9 @@ if ( ! class_exists( 'APOP' ) ) {
|
|||||||
$this->update_post_sort( 'tax', $apop_post_tax );
|
$this->update_post_sort( 'tax', $apop_post_tax );
|
||||||
require_once self::TEMPLATE_DIR . 'success.php';
|
require_once self::TEMPLATE_DIR . 'success.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once self::TEMPLATE_DIR . 'order.php';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//投稿表示順の設定
|
//タクソノミーの表示順の保存
|
||||||
private function update_post_sort( $target, $post_value ) {
|
private function update_post_sort( $target, $post_value ) {
|
||||||
$posts_sort = $post_value['post_sort'];
|
$posts_sort = $post_value['post_sort'];
|
||||||
foreach ( $posts_sort as $cat_id => $posts ) {
|
foreach ( $posts_sort as $cat_id => $posts ) {
|
||||||
@@ -184,13 +255,6 @@ if ( ! class_exists( 'APOP' ) ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-21
@@ -52,16 +52,18 @@ h3 {
|
|||||||
|
|
||||||
.list-orders-outer {
|
.list-orders-outer {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-orders-inner {
|
.list-orders-inner {
|
||||||
width: calc((100% / 2) - 20px);
|
width: calc(100% - 60px);
|
||||||
padding: .5em;
|
margin: 1em auto;
|
||||||
|
padding: .5em 1em;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
background: #eee;
|
||||||
|
border-radius: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sort-menu-list {
|
.sort-menu-list {
|
||||||
@@ -146,15 +148,19 @@ dl.apop-setting-list-dd .sort-custom-field-input {
|
|||||||
|
|
||||||
.drag-sort .product-list {
|
.drag-sort .product-list {
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.enable-box .product-list {
|
.enable-box .product-list {
|
||||||
padding: 1em .3em;
|
width: calc((50%) - 30px);
|
||||||
background: #eee;
|
padding: 1em;
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid #bbb;
|
||||||
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.enable-box .product-list:hover {
|
.enable-box .product-list:hover {
|
||||||
border: 1px solid #bbb;
|
border: 1px solid #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom_field_key_select,
|
.custom_field_key_select,
|
||||||
@@ -172,10 +178,6 @@ dl.apop-setting-list-dd .sort-custom-field-input {
|
|||||||
width: calc((100%) - 60px);
|
width: calc((100%) - 60px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.enable-box .product-list-type-label {
|
|
||||||
width: calc(100% / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-normal-sort .product-list-sort-type {
|
.search-normal-sort .product-list-sort-type {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -196,6 +198,7 @@ dl.apop-setting-list-dd .sort-custom-field-input {
|
|||||||
|
|
||||||
.product-list.no-order {
|
.product-list.no-order {
|
||||||
background: #ababab;
|
background: #ababab;
|
||||||
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-order {
|
.list-order {
|
||||||
@@ -256,7 +259,6 @@ dl.apop-setting-list-dd .sort-custom-field-input {
|
|||||||
.disable-normal-list {
|
.disable-normal-list {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: space-between;
|
|
||||||
margin: .5em 1em 1em 0;
|
margin: .5em 1em 1em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +269,7 @@ dl.apop-setting-list-dd .sort-custom-field-input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.disable-box .product-list {
|
.disable-box .product-list {
|
||||||
width: calc((100% / 2) - 15px);
|
width: calc((25%) - 15px);
|
||||||
display: flex;
|
display: flex;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
@@ -291,7 +293,7 @@ dl.apop-setting-list-dd .sort-custom-field-input {
|
|||||||
.enable-box,
|
.enable-box,
|
||||||
.disable-box {
|
.disable-box {
|
||||||
padding: .5em;
|
padding: .5em;
|
||||||
border: 1px solid #ccc;
|
/*border-bottom: 1px solid #ccc;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
.enable-box h4 {
|
.enable-box h4 {
|
||||||
@@ -311,9 +313,9 @@ dl.apop-setting-list-dd .sort-custom-field-input {
|
|||||||
|
|
||||||
|
|
||||||
@media only screen and (max-width: 1264px) {
|
@media only screen and (max-width: 1264px) {
|
||||||
.enable-box .product-list,
|
|
||||||
.disable-box .product-list {
|
.enable-box .product-list {
|
||||||
display: block;
|
width: calc((100%) - 15px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-normal-sort .product-list {
|
.search-normal-sort .product-list {
|
||||||
@@ -351,13 +353,9 @@ dl.apop-setting-list-dd .sort-custom-field-input {
|
|||||||
width: 98%;
|
width: 98%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-orders-outer {
|
|
||||||
display: block;;
|
|
||||||
}
|
|
||||||
|
|
||||||
.list-orders-inner {
|
.list-orders-inner {
|
||||||
width: auto;
|
width: auto;
|
||||||
margin: 1.5em 0 0 0;
|
margin: 1.5em 1em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dl.apop-setting-list dt {
|
dl.apop-setting-list dt {
|
||||||
@@ -379,4 +377,12 @@ dl.apop-setting-list-dd .sort-custom-field-input {
|
|||||||
width: auto;
|
width: auto;
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.disable-normal-list {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.disable-box .product-list {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+50
-50
@@ -21,15 +21,15 @@ jQuery(function ($) {
|
|||||||
custom_field_select();
|
custom_field_select();
|
||||||
|
|
||||||
function change_tab_menu() {
|
function change_tab_menu() {
|
||||||
let apop_submit_type = $('#apop_submit_type');
|
const apop_submit_type = $('#apop_submit_type');
|
||||||
let order_nav_list = $('.post-order-nav li');
|
const order_nav_list = $('.post-order-nav li');
|
||||||
let order_box = $('.post-order-box');
|
const order_box = $('.post-order-box');
|
||||||
|
|
||||||
init();
|
init();
|
||||||
click_menu();
|
click_menu();
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
let submit_type = apop_submit_type.val();
|
const submit_type = apop_submit_type.val();
|
||||||
order_nav_list.removeClass('en');
|
order_nav_list.removeClass('en');
|
||||||
order_box.hide();
|
order_box.hide();
|
||||||
$('.post-order-nav li:eq(' + submit_type + ')').addClass('en');
|
$('.post-order-nav li:eq(' + submit_type + ')').addClass('en');
|
||||||
@@ -39,7 +39,7 @@ jQuery(function ($) {
|
|||||||
function click_menu() {
|
function click_menu() {
|
||||||
order_nav_list.on('click', function () {
|
order_nav_list.on('click', function () {
|
||||||
if (!$(this).hasClass('en')) {
|
if (!$(this).hasClass('en')) {
|
||||||
let target_index = $(this).index();
|
const target_index = $(this).index();
|
||||||
order_nav_list.removeClass('en');
|
order_nav_list.removeClass('en');
|
||||||
$(this).addClass('en');
|
$(this).addClass('en');
|
||||||
order_box.hide();
|
order_box.hide();
|
||||||
@@ -51,13 +51,13 @@ jQuery(function ($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function order_list() {
|
function order_list() {
|
||||||
let cat_ul_count = $('.post-order-list').length; //カテゴリ総数
|
const cat_ul_count = $('.post-order-list').length; //カテゴリ総数
|
||||||
for (let i = 0; i < cat_ul_count; i++) {
|
for (let i = 0; i < cat_ul_count; i++) {
|
||||||
let my_list = $('.post-order-list:eq(' + i + ')');
|
const my_list = $('.post-order-list:eq(' + i + ')');
|
||||||
my_list.sortable(
|
my_list.sortable(
|
||||||
{
|
{
|
||||||
update: function () {
|
update: function () {
|
||||||
let list_count = $('.product-list', my_list).length;
|
const list_count = $('.product-list', my_list).length;
|
||||||
for (let j = 0; j < list_count; j++) {
|
for (let j = 0; j < list_count; j++) {
|
||||||
let list_order_num = j + 1;
|
let list_order_num = j + 1;
|
||||||
$('.list-order:eq(' + j + ')', my_list).val(list_order_num);
|
$('.list-order:eq(' + j + ')', my_list).val(list_order_num);
|
||||||
@@ -71,38 +71,38 @@ jQuery(function ($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function change_sort_box() {
|
function change_sort_box() {
|
||||||
let s_radio = $('.sort_menu');
|
const s_radio = $('.sort_menu');
|
||||||
let sort_menu_size = $('.sort-menu-list').length;
|
const sort_menu_size = $('.sort-menu-list').length;
|
||||||
|
|
||||||
$('.sort_box').hide();
|
$('.sort_box').hide();
|
||||||
for (let i = 0; i < sort_menu_size; i++) {
|
for (let i = 0; i < sort_menu_size; i++) {
|
||||||
let type_index = $('.sort-menu-list:eq(' + i + ')').data('order_target') - 1;
|
const elm = $('.sort-menu-list:eq(' + i + ')');
|
||||||
$('.sort-menu-list:eq(' + i + ')').siblings('.sort_box:eq(' + type_index + ')').show();
|
const type_index = elm.data('order_target') - 1;
|
||||||
|
elm.siblings('.sort_box:eq(' + type_index + ')').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
s_radio.on('click', function () {
|
s_radio.on('click', function () {
|
||||||
let target_index = $(this).val() - 1;
|
const target_index = $(this).val() - 1;
|
||||||
$(this).parents('.list-orders-inner').find('.sort_box').hide();
|
$(this).parents('.list-orders-inner').find('.sort_box').hide();
|
||||||
$(this).parents('.list-orders-inner').find('.sort_box:eq(' + target_index + ')').show();
|
$(this).parents('.list-orders-inner').find('.sort_box:eq(' + target_index + ')').show();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function select_tax() {
|
function select_tax() {
|
||||||
let select_cat_checkbox = $('.select_cat_checkbox');
|
const select_cat_checkbox = $('.select_cat_checkbox');
|
||||||
let input_chk_size = select_cat_checkbox.length;
|
const input_chk_size = select_cat_checkbox.length;
|
||||||
let i = 0;
|
for (let i = 0; i < input_chk_size; i++) {
|
||||||
|
const chk = $('.select_cat_checkbox:eq(' + i + '):checked').length;
|
||||||
for (i; i < input_chk_size; i++) {
|
const elm = $('.select_cat:eq(' + i + ')');
|
||||||
let chk = $('.select_cat_checkbox:eq(' + i + '):checked').length;
|
if (chk === 1) {
|
||||||
if (chk == 1) {
|
elm.siblings('.select-per-page').show();
|
||||||
$('.select_cat:eq(' + i + ')').siblings('.select-per-page').show();
|
|
||||||
} else {
|
} else {
|
||||||
$('.select_cat:eq(' + i + ')').siblings('.select-per-page').hide();
|
elm.siblings('.select-per-page').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
select_cat_checkbox.on('click', function () {
|
select_cat_checkbox.on('click', function () {
|
||||||
let checked = $(this).prop('checked');
|
const checked = $(this).prop('checked');
|
||||||
if (checked) {
|
if (checked) {
|
||||||
$(this).parent().parent().siblings('.select-per-page').show(200);
|
$(this).parent().parent().siblings('.select-per-page').show(200);
|
||||||
} else {
|
} else {
|
||||||
@@ -113,17 +113,17 @@ jQuery(function ($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function change_search_per_page() {
|
function change_search_per_page() {
|
||||||
let per_page_cat = $('.per_page_search');
|
const per_page_cat = $('.per_page_search');
|
||||||
let per_page_input = $('.per_page_search_input');
|
const per_page_input = $('.per_page_search_input');
|
||||||
|
|
||||||
if (per_page_input.val() == '') {
|
if (per_page_input.val() === '') {
|
||||||
per_page_input.prop('disabled', true);
|
per_page_input.prop('disabled', true);
|
||||||
} else {
|
} else {
|
||||||
per_page_input.prop('disabled', false);
|
per_page_input.prop('disabled', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
per_page_cat.on('click', function () {
|
per_page_cat.on('click', function () {
|
||||||
if ($(this).val() != 'default' && $(this).val() != '-1' && $(this).val() != 'all') {
|
if ($(this).val() !== 'default' && $(this).val() !== '-1' && $(this).val() !== 'all') {
|
||||||
per_page_input.prop('disabled', false);
|
per_page_input.prop('disabled', false);
|
||||||
} else {
|
} else {
|
||||||
per_page_input.val('');
|
per_page_input.val('');
|
||||||
@@ -133,11 +133,11 @@ jQuery(function ($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function change_tax_per_page() {
|
function change_tax_per_page() {
|
||||||
let set_number = $('.set_number');
|
const set_number = $('.set_number');
|
||||||
let input_chk_size = set_number.length;
|
const input_chk_size = set_number.length;
|
||||||
for (let i = 0; i < input_chk_size; i++) {
|
for (let i = 0; i < input_chk_size; i++) {
|
||||||
let input_num_box = $('.set_number:eq(' + i + ')').siblings('.per_page_cat_input');
|
const input_num_box = $('.set_number:eq(' + i + ')').siblings('.per_page_cat_input');
|
||||||
if (input_num_box.val() == '') {
|
if (input_num_box.val() === '') {
|
||||||
input_num_box.prop('disabled', true);
|
input_num_box.prop('disabled', true);
|
||||||
} else {
|
} else {
|
||||||
input_num_box.prop('disabled', false);
|
input_num_box.prop('disabled', false);
|
||||||
@@ -154,57 +154,57 @@ jQuery(function ($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function change_normal_field_sort() {
|
function change_normal_field_sort() {
|
||||||
let s_box = $('.sort_box');
|
const s_box = $('.sort_box');
|
||||||
let targets = '.sort_date_check, .sort_title_check, .sort_ID_check, .sort_modified_check';
|
const targets = '.sort_date_check, .sort_title_check, .sort_ID_check, .sort_modified_check';
|
||||||
s_box.find(targets).each(function () {
|
s_box.find(targets).each(function () {
|
||||||
if ($(this).prop('checked') == false) {
|
if ($(this).prop('checked') === false) {
|
||||||
$(this).parents('.product-list-sort-type').find('.order_param').prop('disabled', true);
|
$(this).parents('.product-list-sort-type').find('.order_param').prop('disabled', true);
|
||||||
let disable_list = $(this).parents('.sort_box').find('.disable-normal-list');
|
const disable_list = $(this).parents('.sort_box').find('.disable-normal-list');
|
||||||
$(this).parents('li').appendTo(disable_list);
|
$(this).parents('li').appendTo(disable_list);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$(targets).on('click', function () {
|
$(targets).on('click', function () {
|
||||||
if ($(this).prop('checked') == true) {
|
if ($(this).prop('checked') === true) {
|
||||||
$(this).parents('.product-list-sort-type').find('.order_param').prop('disabled', false);
|
$(this).parents('.product-list-sort-type').find('.order_param').prop('disabled', false);
|
||||||
let enable_list = $(this).parents('.sort_box').find('.post-order-list');
|
const enable_list = $(this).parents('.sort_box').find('.post-order-list');
|
||||||
$(this).parents('li').appendTo(enable_list).removeClass('no-order').hide().fadeIn(200);
|
$(this).parents('li').appendTo(enable_list).removeClass('no-order').hide().fadeIn(200);
|
||||||
} else {
|
} else {
|
||||||
$(this).parents('.product-list-sort-type').find('.order_param').prop('disabled', true);
|
$(this).parents('.product-list-sort-type').find('.order_param').prop('disabled', true);
|
||||||
let disable_list = $(this).parents('.sort_box').find('.disable-normal-list');
|
const disable_list = $(this).parents('.sort_box').find('.disable-normal-list');
|
||||||
$(this).parents('li').appendTo(disable_list).addClass('no-order').hide().fadeIn(200);
|
$(this).parents('li').appendTo(disable_list).addClass('no-order').hide().fadeIn(200);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function custom_field_select() {
|
function custom_field_select() {
|
||||||
let s_box = $('.sort_box');
|
const s_box = $('.sort_box');
|
||||||
let targets = $('.custom-field-type');
|
const targets = $('.custom-field-type');
|
||||||
let en_dis_check = $('.custom_field_check');
|
const en_dis_check = $('.custom_field_check');
|
||||||
|
|
||||||
// カスタムフィールドソートの有効・無効を判定する。
|
// カスタムフィールドソートの有効・無効を判定する。
|
||||||
// 有効の場合はカスタムフィールド選択or追加のステータスに応じてテキストエリアとセレクトタグenableに変更し表示を切り替える。
|
// 有効の場合はカスタムフィールド選択or追加のステータスに応じてテキストエリアとセレクトタグenableに変更し表示を切り替える。
|
||||||
// 無効の場合はカスタムフィールドのテキストエリアとセレクトタグをDisableにし無効ボックスに移動する。
|
// 無効の場合はカスタムフィールドのテキストエリアとセレクトタグをDisableにし無効ボックスに移動する。
|
||||||
s_box.find('.custom_field_check').each(function () {
|
s_box.find('.custom_field_check').each(function () {
|
||||||
if ($(this).prop('checked') == false) {
|
if ($(this).prop('checked') === false) {
|
||||||
let disable_list = $(this).parents('.sort_box').find('.disable-normal-list');
|
const disable_list = $(this).parents('.sort_box').find('.disable-normal-list');
|
||||||
$(this).parents('li').appendTo(disable_list);
|
$(this).parents('li').appendTo(disable_list);
|
||||||
dis_list($(this));
|
dis_list($(this));
|
||||||
} else {
|
} else {
|
||||||
let target_type = $(this).parents('.product-list-sort-type').find('.custom-field-type').filter(':checked').val();
|
const target_type = $(this).parents('.product-list-sort-type').find('.custom-field-type').filter(':checked').val();
|
||||||
en_dis_list($(this), target_type);
|
en_dis_list($(this), target_type);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//有効・無効チェックボックスクリック時
|
//有効・無効チェックボックスクリック時
|
||||||
en_dis_check.on('click', function () {
|
en_dis_check.on('click', function () {
|
||||||
if ($(this).prop('checked') == true) {
|
if ($(this).prop('checked') === true) {
|
||||||
let enable_list = $(this).parents('.sort_box').find('.post-order-list');
|
const enable_list = $(this).parents('.sort_box').find('.post-order-list');
|
||||||
let target_type = $(this).parents('.product-list-sort-type').find('.custom-field-type').filter(':checked').val();
|
const target_type = $(this).parents('.product-list-sort-type').find('.custom-field-type').filter(':checked').val();
|
||||||
$(this).parents('.product-list-sort-type').find('.order_param').prop('disabled', false);
|
$(this).parents('.product-list-sort-type').find('.order_param').prop('disabled', false);
|
||||||
$(this).parents('li').appendTo(enable_list).removeClass('no-order').hide().fadeIn(200);
|
$(this).parents('li').appendTo(enable_list).removeClass('no-order').hide().fadeIn(200);
|
||||||
en_dis_list($(this), target_type);
|
en_dis_list($(this), target_type);
|
||||||
} else {
|
} else {
|
||||||
let disable_list = $(this).parents('.sort_box').find('.disable-normal-list');
|
const disable_list = $(this).parents('.sort_box').find('.disable-normal-list');
|
||||||
$(this).parents('.product-list-sort-type').find('.order_param').prop('disabled', true);
|
$(this).parents('.product-list-sort-type').find('.order_param').prop('disabled', true);
|
||||||
$(this).parents('li').appendTo(disable_list).addClass('no-order').hide().fadeIn(200);
|
$(this).parents('li').appendTo(disable_list).addClass('no-order').hide().fadeIn(200);
|
||||||
dis_list($(this));
|
dis_list($(this));
|
||||||
@@ -228,11 +228,11 @@ jQuery(function ($) {
|
|||||||
select_msg = '既存のカスタムフィールドから選択';
|
select_msg = '既存のカスタムフィールドから選択';
|
||||||
add_msg = 'APOP専用カスタムフィールドを追加';
|
add_msg = 'APOP専用カスタムフィールドを追加';
|
||||||
}
|
}
|
||||||
if (type == 1) {
|
if (type === 1) {
|
||||||
obj.parents('.product-list-sort-type').find('.custom_field_key_select').prop('disabled', false).show();
|
obj.parents('.product-list-sort-type').find('.custom_field_key_select').prop('disabled', false).show();
|
||||||
obj.parents('.product-list-sort-type').find('.custom_field_key').prop('disabled', true).hide();
|
obj.parents('.product-list-sort-type').find('.custom_field_key').prop('disabled', true).hide();
|
||||||
obj.parents('.product-list-sort-type').find('.custom-field-select-alert').text(select_msg);
|
obj.parents('.product-list-sort-type').find('.custom-field-select-alert').text(select_msg);
|
||||||
} else if (type == 2) {
|
} else if (type === 2) {
|
||||||
obj.parents('.product-list-sort-type').find('.custom_field_key').prop('disabled', false).show();
|
obj.parents('.product-list-sort-type').find('.custom_field_key').prop('disabled', false).show();
|
||||||
obj.parents('.product-list-sort-type').find('.custom_field_key_select').prop('disabled', true).hide();
|
obj.parents('.product-list-sort-type').find('.custom_field_key_select').prop('disabled', true).hide();
|
||||||
obj.parents('.product-list-sort-type').find('.custom-field-select-alert').text(add_msg);
|
obj.parents('.product-list-sort-type').find('.custom-field-select-alert').text(add_msg);
|
||||||
|
|||||||
Binary file not shown.
@@ -5,7 +5,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Archive Post Order Plus\n"
|
"Project-Id-Version: Archive Post Order Plus\n"
|
||||||
"Report-Msgid-Bugs-To: Translator Name <translations@example.com>\n"
|
"Report-Msgid-Bugs-To: Translator Name <translations@example.com>\n"
|
||||||
"POT-Creation-Date: 2021-07-11 17:11+0900\n"
|
"POT-Creation-Date: 2021-07-23 16:59+0900\n"
|
||||||
"PO-Revision-Date: \n"
|
"PO-Revision-Date: \n"
|
||||||
"Last-Translator: NBK45 <nbk.develop@gmail.com>\n"
|
"Last-Translator: NBK45 <nbk.develop@gmail.com>\n"
|
||||||
"Language-Team: NBK45 <nbk.develop@gmail.com>\n"
|
"Language-Team: NBK45 <nbk.develop@gmail.com>\n"
|
||||||
@@ -27,84 +27,89 @@ msgstr ""
|
|||||||
msgid "APO + custom field settings"
|
msgid "APO + custom field settings"
|
||||||
msgstr "APO+カスタムフィールド"
|
msgstr "APO+カスタムフィールド"
|
||||||
|
|
||||||
#: class/class.apop.apop_post.php:54 template/order.php:8
|
#: class/class.apop.apop_post.php:57 template/order.php:8
|
||||||
msgid "Your latest posts"
|
msgid "Your latest posts"
|
||||||
msgstr "最新の投稿"
|
msgstr "最新の投稿"
|
||||||
|
|
||||||
#: class/class.apop.apop_post.php:55 template/order.php:9 template/order.php:54
|
#: class/class.apop.apop_post.php:58 template/order.php:9 template/order.php:55
|
||||||
msgid "Search"
|
msgid "Search"
|
||||||
msgstr "検索"
|
msgstr "検索"
|
||||||
|
|
||||||
#: class/class.apop.apop_post.php:56
|
#: class/class.apop.apop_post.php:59
|
||||||
msgid "Category, Tag, Custom Taxonomy"
|
msgid "Category, Tag, Custom Taxonomy"
|
||||||
msgstr "カテゴリー、タグ、カスタム分類"
|
msgstr "カテゴリー、タグ、カスタム分類"
|
||||||
|
|
||||||
#: class/class.apop.apop_ui.php:292
|
#: class/class.apop.apop_post.php:60
|
||||||
|
msgid "Custom posts archive"
|
||||||
|
msgstr "カスタム投稿アーカイブ"
|
||||||
|
|
||||||
|
#: class/class.apop.apop_ui.php:352
|
||||||
|
msgid "Select"
|
||||||
|
msgstr "選択"
|
||||||
|
|
||||||
|
#: class/class.apop.apop_ui.php:357
|
||||||
|
msgid "Add"
|
||||||
|
msgstr "追加"
|
||||||
|
|
||||||
|
#: class/class.apop.apop_ui.php:364
|
||||||
|
msgid "Type"
|
||||||
|
msgstr "値タイプ"
|
||||||
|
|
||||||
|
#: class/class.apop.apop_ui.php:369
|
||||||
|
msgid "Text"
|
||||||
|
msgstr "テキスト"
|
||||||
|
|
||||||
|
#: class/class.apop.apop_ui.php:373
|
||||||
|
msgid "Number"
|
||||||
|
msgstr "数値"
|
||||||
|
|
||||||
|
#: class/class.apop.apop_ui.php:469
|
||||||
msgid "Published"
|
msgid "Published"
|
||||||
msgstr "投稿日"
|
msgstr "投稿日"
|
||||||
|
|
||||||
#: class/class.apop.apop_ui.php:293
|
#: class/class.apop.apop_ui.php:470
|
||||||
msgid "Post Title"
|
msgid "Post Title"
|
||||||
msgstr "タイトル"
|
msgstr "タイトル"
|
||||||
|
|
||||||
#: class/class.apop.apop_ui.php:295
|
#: class/class.apop.apop_ui.php:472
|
||||||
msgid "Modified"
|
msgid "Modified"
|
||||||
msgstr "更新日"
|
msgstr "更新日"
|
||||||
|
|
||||||
#: class/class.apop.apop_ui.php:296
|
#: class/class.apop.apop_ui.php:473
|
||||||
msgid "Custom filed 1"
|
msgid "Custom filed 1"
|
||||||
msgstr "カスタムフィールド1"
|
msgstr "カスタムフィールド1"
|
||||||
|
|
||||||
#: class/class.apop.apop_ui.php:297
|
#: class/class.apop.apop_ui.php:474
|
||||||
msgid "Custom filed 2"
|
msgid "Custom filed 2"
|
||||||
msgstr "カスタムフィールド2"
|
msgstr "カスタムフィールド2"
|
||||||
|
|
||||||
#: class/class.apop.apop_ui.php:298
|
#: class/class.apop.apop_ui.php:475
|
||||||
msgid "Custom filed 3"
|
msgid "Custom filed 3"
|
||||||
msgstr "カスタムフィールド3"
|
msgstr "カスタムフィールド3"
|
||||||
|
|
||||||
#: class/class.apop.apop_ui.php:299
|
#: class/class.apop.apop_ui.php:476
|
||||||
msgid "Custom filed 4"
|
msgid "Custom filed 4"
|
||||||
msgstr "カスタムフィールド4"
|
msgstr "カスタムフィールド4"
|
||||||
|
|
||||||
#: class/class.apop.apop_ui.php:321 template/order.php:33 template/order.php:64
|
#: class/class.apop.apop_ui.php:497 template/order.php:34 template/order.php:65
|
||||||
|
#: template/order_parts_custom_posts.php:46
|
||||||
#: template/order_parts_taxonomy.php:46
|
#: template/order_parts_taxonomy.php:46
|
||||||
msgid "Enabled"
|
msgid "Enabled"
|
||||||
msgstr "有効"
|
msgstr "有効"
|
||||||
|
|
||||||
#: class/class.apop.apop_ui.php:327
|
#: class/class.apop.apop_ui.php:503
|
||||||
msgid "Asc"
|
msgid "Asc"
|
||||||
msgstr "昇順"
|
msgstr "昇順"
|
||||||
|
|
||||||
#: class/class.apop.apop_ui.php:331
|
#: class/class.apop.apop_ui.php:507
|
||||||
msgid "Desc"
|
msgid "Desc"
|
||||||
msgstr "降順"
|
msgstr "降順"
|
||||||
|
|
||||||
#: class/class.apop.apop_ui.php:358
|
#: class/class.apop.order.php:39
|
||||||
msgid "Select"
|
|
||||||
msgstr "選択"
|
|
||||||
|
|
||||||
#: class/class.apop.apop_ui.php:363
|
|
||||||
msgid "Add"
|
|
||||||
msgstr "追加"
|
|
||||||
|
|
||||||
#: class/class.apop.apop_ui.php:370
|
|
||||||
msgid "Type"
|
|
||||||
msgstr "値タイプ"
|
|
||||||
|
|
||||||
#: class/class.apop.apop_ui.php:375
|
|
||||||
msgid "Text"
|
|
||||||
msgstr "テキスト"
|
|
||||||
|
|
||||||
#: class/class.apop.apop_ui.php:379
|
|
||||||
msgid "Number"
|
|
||||||
msgstr "数値"
|
|
||||||
|
|
||||||
#: class/class.apop.order.php:36
|
|
||||||
msgid "Display number / target setting"
|
msgid "Display number / target setting"
|
||||||
msgstr "表示件数・対象設定"
|
msgstr "表示件数・対象設定"
|
||||||
|
|
||||||
#: class/class.apop.order.php:44 template/order.php:5
|
#: class/class.apop.order.php:47 template/order.php:5
|
||||||
msgid "Sorting"
|
msgid "Sorting"
|
||||||
msgstr "並べ替え"
|
msgstr "並べ替え"
|
||||||
|
|
||||||
@@ -112,48 +117,59 @@ msgstr "並べ替え"
|
|||||||
msgid "apop-lang-en"
|
msgid "apop-lang-en"
|
||||||
msgstr "apop-lang-ja"
|
msgstr "apop-lang-ja"
|
||||||
|
|
||||||
#: template/order.php:10 template/order.php:86
|
#: template/order.php:10 template/order.php:87
|
||||||
msgid "Category"
|
msgid "Category"
|
||||||
msgstr "カテゴリー"
|
msgstr "カテゴリー"
|
||||||
|
|
||||||
#: template/order.php:11 template/order.php:95
|
#: template/order.php:11 template/order.php:96
|
||||||
msgid "Tag"
|
msgid "Tag"
|
||||||
msgstr "タグ"
|
msgstr "タグ"
|
||||||
|
|
||||||
#: template/order.php:12 template/order.php:104
|
#: template/order.php:12 template/order.php:105
|
||||||
msgid "Custom taxonomy"
|
msgid "Custom taxonomy"
|
||||||
msgstr "カスタム分類"
|
msgstr "カスタム分類"
|
||||||
|
|
||||||
#: template/order.php:23
|
#: template/order.php:13 template/order.php:113
|
||||||
|
msgid "Custom posts"
|
||||||
|
msgstr "カスタム投稿アーカイブ"
|
||||||
|
|
||||||
|
#: template/order.php:24
|
||||||
msgid "Your latest posts / Settings - Reading Settings"
|
msgid "Your latest posts / Settings - Reading Settings"
|
||||||
msgstr "最新の投稿(設定-表示設定ーホームページの表示)"
|
msgstr "最新の投稿(設定-表示設定ーホームページの表示)"
|
||||||
|
|
||||||
#: template/order.php:30 template/order.php:61
|
#: template/order.php:31 template/order.php:62
|
||||||
|
#: template/order_parts_custom_posts.php:36
|
||||||
|
#: template/order_parts_custom_posts.php:44
|
||||||
#: template/order_parts_taxonomy.php:36 template/order_parts_taxonomy.php:44
|
#: template/order_parts_taxonomy.php:36 template/order_parts_taxonomy.php:44
|
||||||
msgid "Click \"Save Changes\" to register the sort."
|
msgid "Click \"Save Changes\" to register the sort."
|
||||||
msgstr "並べ替えを登録するには「変更を保存」をクリックしてください。"
|
msgstr "並べ替えを登録するには「変更を保存」をクリックしてください。"
|
||||||
|
|
||||||
#: template/order.php:39 template/order.php:70
|
#: template/order.php:40 template/order.php:71
|
||||||
|
#: template/order_parts_custom_posts.php:52
|
||||||
#: template/order_parts_taxonomy.php:52
|
#: template/order_parts_taxonomy.php:52
|
||||||
msgid "Disabled"
|
msgid "Disabled"
|
||||||
msgstr "無効"
|
msgstr "無効"
|
||||||
|
|
||||||
#: template/order.php:110 template/setting.php:45
|
#: template/order.php:120 template/setting.php:46
|
||||||
msgid "Save changes"
|
msgid "Save changes"
|
||||||
msgstr "変更を保存"
|
msgstr "変更を保存"
|
||||||
|
|
||||||
#: template/order_parts_menu.php:6 template/order_parts_taxonomy.php:22
|
#: template/order_parts_custom_posts.php:22 template/order_parts_menu.php:6
|
||||||
|
#: template/order_parts_taxonomy.php:22
|
||||||
msgid "Standard + custom field sort"
|
msgid "Standard + custom field sort"
|
||||||
msgstr "標準+カスタムフィールドソート"
|
msgstr "標準+カスタムフィールドソート"
|
||||||
|
|
||||||
#: template/order_parts_menu.php:9 template/order_parts_taxonomy.php:29
|
#: template/order_parts_custom_posts.php:29 template/order_parts_menu.php:9
|
||||||
|
#: template/order_parts_taxonomy.php:29
|
||||||
msgid "Drag sort"
|
msgid "Drag sort"
|
||||||
msgstr "ドラッグソート"
|
msgstr "ドラッグソート"
|
||||||
|
|
||||||
|
#: template/order_parts_custom_posts.php:60
|
||||||
#: template/order_parts_taxonomy.php:59
|
#: template/order_parts_taxonomy.php:59
|
||||||
msgid "No"
|
msgid "No"
|
||||||
msgstr "並べ替えをカスタマイズする「"
|
msgstr "並べ替えをカスタマイズする「"
|
||||||
|
|
||||||
|
#: template/order_parts_custom_posts.php:60
|
||||||
#: template/order_parts_taxonomy.php:59
|
#: template/order_parts_taxonomy.php:59
|
||||||
msgid "has been selected."
|
msgid "has been selected."
|
||||||
msgstr "」は選択されていません。"
|
msgstr "」は選択されていません。"
|
||||||
@@ -170,19 +186,23 @@ msgstr "全体設定"
|
|||||||
msgid "Displayed per page"
|
msgid "Displayed per page"
|
||||||
msgstr "1ページ表示件数"
|
msgstr "1ページ表示件数"
|
||||||
|
|
||||||
#: template/setting.php:16 template/setting_parts_taxonomy.php:31
|
#: template/setting.php:16 template/setting_parts_customposts.php:31
|
||||||
|
#: template/setting_parts_taxonomy.php:31
|
||||||
msgid "Follow display settings"
|
msgid "Follow display settings"
|
||||||
msgstr "表示設定に従う"
|
msgstr "表示設定に従う"
|
||||||
|
|
||||||
#: template/setting.php:18 template/setting_parts_taxonomy.php:32
|
#: template/setting.php:18 template/setting_parts_customposts.php:33
|
||||||
|
#: template/setting_parts_taxonomy.php:32
|
||||||
msgid "Posts"
|
msgid "Posts"
|
||||||
msgstr "件"
|
msgstr "件"
|
||||||
|
|
||||||
#: template/setting.php:22 template/setting_parts_taxonomy.php:42
|
#: template/setting.php:22 template/setting_parts_customposts.php:44
|
||||||
|
#: template/setting_parts_taxonomy.php:42
|
||||||
msgid "All posts"
|
msgid "All posts"
|
||||||
msgstr "全件"
|
msgstr "全件"
|
||||||
|
|
||||||
#: template/setting.php:28 template/setting_parts_taxonomy.php:47
|
#: template/setting.php:28 template/setting_parts_customposts.php:50
|
||||||
|
#: template/setting_parts_taxonomy.php:47
|
||||||
msgid "Set the number posts"
|
msgid "Set the number posts"
|
||||||
msgstr "表示数設定"
|
msgstr "表示数設定"
|
||||||
|
|
||||||
@@ -198,10 +218,16 @@ msgstr "タグ設定"
|
|||||||
msgid "Custom Taxonomies setting"
|
msgid "Custom Taxonomies setting"
|
||||||
msgstr "カスタム分類設定"
|
msgstr "カスタム分類設定"
|
||||||
|
|
||||||
|
#: template/setting.php:43
|
||||||
|
msgid "Custom Posts Archive setting"
|
||||||
|
msgstr "カスタム投稿アーカイブ設定"
|
||||||
|
|
||||||
|
#: template/setting_parts_customposts.php:3
|
||||||
#: template/setting_parts_taxonomy.php:3
|
#: template/setting_parts_taxonomy.php:3
|
||||||
msgid "Targets"
|
msgid "Targets"
|
||||||
msgstr "対象"
|
msgstr "対象"
|
||||||
|
|
||||||
|
#: template/setting_parts_customposts.php:38
|
||||||
#: template/setting_parts_taxonomy.php:37
|
#: template/setting_parts_taxonomy.php:37
|
||||||
msgid "Follow global settings"
|
msgid "Follow global settings"
|
||||||
msgstr "全体設定に従う"
|
msgstr "全体設定に従う"
|
||||||
|
|||||||
+52
-5
@@ -1,10 +1,10 @@
|
|||||||
=== Archive Post Order Plus ===
|
=== Archive Post Order Plus ===
|
||||||
Contributors: nbk45
|
Contributors: nbk45
|
||||||
Tags: latest posts order,categories post order,tags post order,custom taxonomy post order
|
Tags: latest posts order,categories post order,tags post order,custom taxonomy post order
|
||||||
Requires at least: 4.9
|
Requires at least: 6.7
|
||||||
Tested up to: 5.8
|
Tested up to: 6.9
|
||||||
Requires PHP: 7.0
|
Requires PHP: 8.3
|
||||||
Stable tag: 1.1.7
|
Stable tag: 1.2.4
|
||||||
License: GPLv2 or later
|
License: GPLv2 or later
|
||||||
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
|
||||||
@@ -18,6 +18,7 @@ This plugin is a plugin that customizes the posting order below.
|
|||||||
- Category
|
- Category
|
||||||
- Tag
|
- Tag
|
||||||
- Custom Taxonomy
|
- Custom Taxonomy
|
||||||
|
- Custom Posts Archive
|
||||||
|
|
||||||
このプラグインは、下記の投稿表示順をカスタマイズするプラグインです。
|
このプラグインは、下記の投稿表示順をカスタマイズするプラグインです。
|
||||||
・[設定]-[表示設定]の「最新の投稿」
|
・[設定]-[表示設定]の「最新の投稿」
|
||||||
@@ -25,6 +26,7 @@ This plugin is a plugin that customizes the posting order below.
|
|||||||
・カテゴリー
|
・カテゴリー
|
||||||
・タグ
|
・タグ
|
||||||
・カスタム分類
|
・カスタム分類
|
||||||
|
・カスタム投稿アーカイブ
|
||||||
|
|
||||||
= Specification =
|
= Specification =
|
||||||
Select either 1) standard + custom field sort or 2) drag sort for the display order.
|
Select either 1) standard + custom field sort or 2) drag sort for the display order.
|
||||||
@@ -69,7 +71,6 @@ In the list of posts displayed in the list, drag the posts to set the display or
|
|||||||
|
|
||||||
== Frequently Asked Questions ==
|
== Frequently Asked Questions ==
|
||||||
|
|
||||||
|
|
||||||
== Screenshots ==
|
== Screenshots ==
|
||||||
screenshot-1.png
|
screenshot-1.png
|
||||||
screenshot-2.png
|
screenshot-2.png
|
||||||
@@ -81,6 +82,52 @@ screenshot-7.png
|
|||||||
screenshot-8.png
|
screenshot-8.png
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
= 1.2.4 =
|
||||||
|
・WordPress6.9動作確認
|
||||||
|
・PHP8.3対応修正
|
||||||
|
|
||||||
|
= 1.2.3 =
|
||||||
|
confirm WordPress6.5
|
||||||
|
|
||||||
|
= 1.2.2 =
|
||||||
|
confirm WordPress6.3
|
||||||
|
confirm WordPress6.1
|
||||||
|
|
||||||
|
WordPress6.1動作確認
|
||||||
|
|
||||||
|
= 1.2.1 =
|
||||||
|
confirm WordPress6.0
|
||||||
|
Fix template typos.
|
||||||
|
Add method return type specification.
|
||||||
|
Delete unnecessary variable assignments.
|
||||||
|
Add condition to file include.
|
||||||
|
|
||||||
|
WordPress6.0動作確認
|
||||||
|
テンプレートのミスタイプの修正
|
||||||
|
メソッドの戻り型指定の追加
|
||||||
|
不要な変数代入の削除
|
||||||
|
ファイルインクルードの条件追加
|
||||||
|
|
||||||
|
= 1.2.0 =
|
||||||
|
confirm WordPress5.9
|
||||||
|
Fixed Notice error in custom post archive.
|
||||||
|
|
||||||
|
WordPress5.9動作確認
|
||||||
|
カスタム投稿アーカイブのNoticeエラー修正
|
||||||
|
|
||||||
|
= 1.1.9 =
|
||||||
|
Changed the layout of the sort menu.
|
||||||
|
Modified JavaScript variable declaration and stored element specification in variable.
|
||||||
|
|
||||||
|
並べ替えのレイアウトを変更
|
||||||
|
JavaScriptで要素を変数に格納
|
||||||
|
|
||||||
|
= 1.1.8 =
|
||||||
|
Supports sort settings for custom post archives.
|
||||||
|
Bug fixed: "Follow global settings" of category, tag, and custom classification does not work properly when all items are selected in global settings.
|
||||||
|
|
||||||
|
カスタム投稿アーカイブのソート設定対応
|
||||||
|
全体設定で全件を選択している時にカテゴリー、タグ、カスタム分類の「全体設定に従う」が正常機能しないバグの修正
|
||||||
|
|
||||||
= 1.1.7 =
|
= 1.1.7 =
|
||||||
Supports translation.
|
Supports translation.
|
||||||
|
|||||||
+20
-6
@@ -10,6 +10,7 @@ $submit_type = APOP_UI::input_post_filter( 'apop_submit_type', 'str' );
|
|||||||
<li><?php _e( 'Category', APOP_DOMAIN ); ?></li>
|
<li><?php _e( 'Category', APOP_DOMAIN ); ?></li>
|
||||||
<li><?php _e( 'Tag', APOP_DOMAIN ); ?></li>
|
<li><?php _e( 'Tag', APOP_DOMAIN ); ?></li>
|
||||||
<li><?php _e( 'Custom taxonomy', APOP_DOMAIN ); ?></li>
|
<li><?php _e( 'Custom taxonomy', APOP_DOMAIN ); ?></li>
|
||||||
|
<li><?php _e( 'Custom posts', APOP_DOMAIN ); ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
@@ -17,6 +18,7 @@ $submit_type = APOP_UI::input_post_filter( 'apop_submit_type', 'str' );
|
|||||||
<?php wp_nonce_field( 'sh_options' ); ?>
|
<?php wp_nonce_field( 'sh_options' ); ?>
|
||||||
<input id="apop_submit_type" type="hidden" name="apop_submit_type"
|
<input id="apop_submit_type" type="hidden" name="apop_submit_type"
|
||||||
value="<?php echo esc_attr( $submit_type ); ?>">
|
value="<?php echo esc_attr( $submit_type ); ?>">
|
||||||
|
<!-- 最新の投稿の設定 -->
|
||||||
<div class="post-order-box">
|
<div class="post-order-box">
|
||||||
<div class="list-orders-outer">
|
<div class="list-orders-outer">
|
||||||
<div class="list-orders-inner">
|
<div class="list-orders-inner">
|
||||||
@@ -26,7 +28,6 @@ $submit_type = APOP_UI::input_post_filter( 'apop_submit_type', 'str' );
|
|||||||
$order_target = APOP_UI::get_order_type( $order_target_type );
|
$order_target = APOP_UI::get_order_type( $order_target_type );
|
||||||
?>
|
?>
|
||||||
<?php include APOP_PLUGIN_PATH . 'template/order_parts_menu.php'; ?>
|
<?php include APOP_PLUGIN_PATH . 'template/order_parts_menu.php'; ?>
|
||||||
<hr>
|
|
||||||
<p><?php _e( 'Click "Save Changes" to register the sort.', APOP_DOMAIN ); ?></p>
|
<p><?php _e( 'Click "Save Changes" to register the sort.', APOP_DOMAIN ); ?></p>
|
||||||
<div class="sort_box">
|
<div class="sort_box">
|
||||||
<div class="enable-box">
|
<div class="enable-box">
|
||||||
@@ -48,6 +49,7 @@ $submit_type = APOP_UI::input_post_filter( 'apop_submit_type', 'str' );
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 検索の設定 -->
|
||||||
<div class="post-order-box">
|
<div class="post-order-box">
|
||||||
<div class="list-orders-outer">
|
<div class="list-orders-outer">
|
||||||
<div class="list-orders-inner">
|
<div class="list-orders-inner">
|
||||||
@@ -57,7 +59,6 @@ $submit_type = APOP_UI::input_post_filter( 'apop_submit_type', 'str' );
|
|||||||
$order_target = APOP_UI::get_order_type( $order_target_type );
|
$order_target = APOP_UI::get_order_type( $order_target_type );
|
||||||
?>
|
?>
|
||||||
<?php include APOP_PLUGIN_PATH . 'template/order_parts_menu.php'; ?>
|
<?php include APOP_PLUGIN_PATH . 'template/order_parts_menu.php'; ?>
|
||||||
<hr>
|
|
||||||
<p><?php _e( 'Click "Save Changes" to register the sort.', APOP_DOMAIN ); ?></p>
|
<p><?php _e( 'Click "Save Changes" to register the sort.', APOP_DOMAIN ); ?></p>
|
||||||
<div class="sort_box">
|
<div class="sort_box">
|
||||||
<div class="enable-box">
|
<div class="enable-box">
|
||||||
@@ -79,34 +80,47 @@ $submit_type = APOP_UI::input_post_filter( 'apop_submit_type', 'str' );
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- カテゴリーの設定 -->
|
||||||
<div class="post-order-box">
|
<div class="post-order-box">
|
||||||
<div class="tax_sort_box">
|
<div class="tax_sort_box">
|
||||||
<?php
|
<?php
|
||||||
$tax_lists = array( 'category' => APOP_UI::get_cat_tag_list( 'cat', 'category' ) );
|
$tax_lists = array( 'category' => APOP_UI::get_cat_tag_list( 'cat', 'category' ) );
|
||||||
$tax_title_text = __( 'Category', APOP_DOMAIN );
|
$tax_title_text = __( 'Category', APOP_DOMAIN );
|
||||||
|
include APOP_PLUGIN_PATH . 'template/order_parts_taxonomy.php';
|
||||||
?>
|
?>
|
||||||
<?php include APOP_PLUGIN_PATH . 'template/order_parts_taxonomy.php'; ?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- タグの設定 -->
|
||||||
<div class="post-order-box">
|
<div class="post-order-box">
|
||||||
<div class="tax_sort_box">
|
<div class="tax_sort_box">
|
||||||
<?php
|
<?php
|
||||||
$tax_lists = array( 'tag_id' => APOP_UI::get_cat_tag_list( 'tag', 'post_tag' ) );
|
$tax_lists = array( 'tag_id' => APOP_UI::get_cat_tag_list( 'tag', 'post_tag' ) );
|
||||||
$tax_title_text = __( 'Tag', APOP_DOMAIN );
|
$tax_title_text = __( 'Tag', APOP_DOMAIN );
|
||||||
|
include APOP_PLUGIN_PATH . 'template/order_parts_taxonomy.php';
|
||||||
?>
|
?>
|
||||||
<?php include APOP_PLUGIN_PATH . 'template/order_parts_taxonomy.php'; ?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- カスタム分類の設定 -->
|
||||||
<div class="post-order-box">
|
<div class="post-order-box">
|
||||||
<div class="tax_sort_box">
|
<div class="tax_sort_box">
|
||||||
<?php
|
<?php
|
||||||
$tax_lists = array( 'taxonomy' => APOP_UI::get_cat_tag_list( 'tax', 'taxonomy' ) );
|
$tax_lists = array( 'taxonomy' => APOP_UI::get_cat_tag_list( 'tax', 'taxonomy' ) );
|
||||||
$tax_title_text = __( 'Custom taxonomy', APOP_DOMAIN );
|
$tax_title_text = __( 'Custom taxonomy', APOP_DOMAIN );
|
||||||
|
include APOP_PLUGIN_PATH . 'template/order_parts_taxonomy.php'; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- カスタム投稿アーカイブの設定 -->
|
||||||
|
<div class="post-order-box">
|
||||||
|
<div class="tax_sort_box">
|
||||||
|
<?php
|
||||||
|
$custom_posts_lists = APOP_UI::get_enable_custompost_archive();
|
||||||
|
$custom_posts_title_text = __( 'Custom posts', APOP_DOMAIN );
|
||||||
|
include APOP_PLUGIN_PATH . 'template/order_parts_custom_posts.php';
|
||||||
?>
|
?>
|
||||||
<?php include APOP_PLUGIN_PATH . 'template/order_parts_taxonomy.php'; ?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p class="apop-submit"><input type="submit" name="submit" class="button-primary" value="<?php _e( 'Save changes', APOP_DOMAIN ); ?>"/></p>
|
<p class="apop-submit"><input type="submit" name="submit" class="button-primary"
|
||||||
|
value="<?php _e( 'Save changes', APOP_DOMAIN ); ?>"/></p>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<?php if ( isset( $custom_posts_lists, $custom_posts_title_text ) ): ?>
|
||||||
|
<div class="list-orders-outer">
|
||||||
|
<?php if ( count( $custom_posts_lists ) > 0 ): ?>
|
||||||
|
<?php foreach ( $custom_posts_lists as $custom_post ) : ?>
|
||||||
|
<div class="list-orders-inner">
|
||||||
|
<h3><?php echo esc_html( $custom_post['label'] ); ?></h3>
|
||||||
|
<?php
|
||||||
|
$order_target_data = get_option( '_apop_custompost_archive_sort_type' );
|
||||||
|
if ( isset( $order_target_data[ $custom_post['slug'] ] ) ) {
|
||||||
|
$order_target = $order_target_data[ $custom_post['slug'] ];
|
||||||
|
} else {
|
||||||
|
$order_target = 2;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!-- ソートタイプ -->
|
||||||
|
<ul class="sort-menu-list"
|
||||||
|
data-order_target="<?php echo esc_attr( $order_target ); ?>">
|
||||||
|
<li>
|
||||||
|
<label>
|
||||||
|
<input class="sort_menu" type="radio"
|
||||||
|
name="_apop_custompost_archive_sort_type[<?php echo esc_attr( $custom_post['slug'] ); ?>]"
|
||||||
|
value="2"<?php checked( $order_target, 2 ); ?>><?php _e( 'Standard + custom field sort', APOP_DOMAIN ); ?>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label>
|
||||||
|
<input class="sort_menu" type="radio"
|
||||||
|
name="_apop_custompost_archive_sort_type[<?php echo esc_attr( $custom_post['slug'] ); ?>]"
|
||||||
|
value="1"<?php checked( $order_target, 1 ); ?>><?php _e( 'Drag sort', APOP_DOMAIN ); ?>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="sort_box">
|
||||||
|
<p><?php _e( 'Click "Save Changes" to register the sort.', APOP_DOMAIN ); ?></p>
|
||||||
|
<ul class="post-order-list drag-sort">
|
||||||
|
<?php echo APOP_UI::create_custompost_archive_order_list( $custom_post['slug'] ); ?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sort_box">
|
||||||
|
<p><?php _e( 'Click "Save Changes" to register the sort.', APOP_DOMAIN ); ?></p>
|
||||||
|
<div class="enable-box">
|
||||||
|
<h4><?php _e( 'Enabled', APOP_DOMAIN ); ?></h4>
|
||||||
|
<ul class="post-order-list search-normal-sort">
|
||||||
|
<?php APOP_UI::create_custompost_archive_normal_list( $custom_post['slug'] ); ?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="disable-box">
|
||||||
|
<h4><?php _e( 'Disabled', APOP_DOMAIN ); ?></h4>
|
||||||
|
<ul class="disable-normal-list"></ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<p class="no-registered-exp"><?php _e( 'No', APOP_DOMAIN ); ?><?php echo esc_html( $custom_posts_title_text . ' ' ); ?><?php _e( 'has been selected.', APOP_DOMAIN ); ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif;
|
||||||
@@ -32,7 +32,6 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="sort_box">
|
<div class="sort_box">
|
||||||
<hr>
|
|
||||||
<p><?php _e( 'Click "Save Changes" to register the sort.', APOP_DOMAIN ); ?></p>
|
<p><?php _e( 'Click "Save Changes" to register the sort.', APOP_DOMAIN ); ?></p>
|
||||||
<ul class="post-order-list drag-sort">
|
<ul class="post-order-list drag-sort">
|
||||||
<?php echo APOP_UI::create_order_list( $tax_data, $tax_key ); ?>
|
<?php echo APOP_UI::create_order_list( $tax_data, $tax_key ); ?>
|
||||||
@@ -40,7 +39,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="sort_box">
|
<div class="sort_box">
|
||||||
<hr>
|
|
||||||
<p><?php _e( 'Click "Save Changes" to register the sort.', APOP_DOMAIN ); ?></p>
|
<p><?php _e( 'Click "Save Changes" to register the sort.', APOP_DOMAIN ); ?></p>
|
||||||
<div class="enable-box">
|
<div class="enable-box">
|
||||||
<h4><?php _e( 'Enabled', APOP_DOMAIN ); ?></h4>
|
<h4><?php _e( 'Enabled', APOP_DOMAIN ); ?></h4>
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
<?php APOP_UI::disp_tax_setting( 'category', __( 'Categories setting', APOP_DOMAIN ), '_apop_cat_order' ); ?>
|
<?php APOP_UI::disp_tax_setting( 'category', __( 'Categories setting', APOP_DOMAIN ), '_apop_cat_order' ); ?>
|
||||||
<?php APOP_UI::disp_tax_setting( 'post_tag', __( 'Tags setting', APOP_DOMAIN ), '_apop_tag_order' ); ?>
|
<?php APOP_UI::disp_tax_setting( 'post_tag', __( 'Tags setting', APOP_DOMAIN ), '_apop_tag_order' ); ?>
|
||||||
<?php APOP_UI::disp_tax_setting( 'taxonomy', __( 'Custom Taxonomies setting', APOP_DOMAIN ), '_apop_tax_order' ); ?>
|
<?php APOP_UI::disp_tax_setting( 'taxonomy', __( 'Custom Taxonomies setting', APOP_DOMAIN ), '_apop_tax_order' ); ?>
|
||||||
|
<?php APOP_UI::disp_customposts_setting( 'custompost_archive', __( 'Custom Posts Archive setting', APOP_DOMAIN ), '_apop_custompost_archive_order' ); ?>
|
||||||
</table>
|
</table>
|
||||||
<p class="submit"><input type="submit" name="Submit" class="button-primary"
|
<p class="submit"><input type="submit" name="Submit" class="button-primary"
|
||||||
value="<?php _e( 'Save changes', APOP_DOMAIN ); ?>"/>
|
value="<?php _e( 'Save changes', APOP_DOMAIN ); ?>"/>
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<?php if ( isset( $custom_post_data, $order_name, $order ) ): ?>
|
||||||
|
<dl class="apop-setting-list">
|
||||||
|
<dt><?php _e( 'Targets', APOP_DOMAIN ); ?></dt>
|
||||||
|
<dd>
|
||||||
|
<ul class="order-setting-list">
|
||||||
|
<?php foreach ( $custom_post_data as $custom_post_datum => $label ): ?>
|
||||||
|
<?php
|
||||||
|
$opt_cat = get_option( $order_name );
|
||||||
|
$check_slug = $opt_cat['target_post'][ $custom_post_datum ] ?? '';
|
||||||
|
?>
|
||||||
|
<li>
|
||||||
|
<div class="select_cat">
|
||||||
|
<label>
|
||||||
|
<input type="hidden"
|
||||||
|
name="<?php echo esc_attr( $order_name ); ?>[target_post][<?php echo esc_attr( $custom_post_datum ); ?>]"
|
||||||
|
value="0">
|
||||||
|
<input class="select_cat_checkbox" type="checkbox"
|
||||||
|
name="<?php echo esc_attr( $order_name ); ?>[target_post][<?php echo esc_attr( $custom_post_datum ); ?>]"
|
||||||
|
<?php checked( $check_slug, 1 ); ?>
|
||||||
|
value="1">
|
||||||
|
<?php echo esc_html( $label ); ?>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<?php $per_page_data = APOP_UI::create_custom_posts_per_page( get_option( '_apop_per_page' ), $order, $custom_post_datum ); ?>
|
||||||
|
<div class="select-per-page">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<label>
|
||||||
|
<input class="per_page_cat" type="radio"
|
||||||
|
name="_apop_per_page[<?php echo esc_attr($order); ?>][<?php echo esc_attr( $custom_post_datum ); ?>]"
|
||||||
|
value="default"<?php checked( $per_page_data['_per_page'], 'default' ); ?>><?php _e( 'Follow display settings', APOP_DOMAIN ); ?>
|
||||||
|
(<?php echo esc_html( get_option( 'posts_per_page' ) ); ?>
|
||||||
|
<?php _e( 'Posts', APOP_DOMAIN ); ?>)</label>
|
||||||
|
</li>
|
||||||
|
<li><label>
|
||||||
|
<input class="per_page_cat" type="radio"
|
||||||
|
name="_apop_per_page[<?php echo esc_attr( $order ); ?>][<?php echo esc_attr( $custom_post_datum ); ?>]"
|
||||||
|
value="all"<?php checked( $per_page_data['_per_page'], 'all' ); ?>><?php _e( 'Follow global settings', APOP_DOMAIN ); ?>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<li><label>
|
||||||
|
<input class="per_page_cat" type="radio"
|
||||||
|
name="_apop_per_page[<?php echo esc_attr( $order ); ?>][<?php echo esc_attr( $custom_post_datum ); ?>]"
|
||||||
|
value="-1"<?php checked( $per_page_data['_per_page'], '-1' ); ?>><?php _e( 'All posts', APOP_DOMAIN ); ?>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<li class="set_number_list">
|
||||||
|
<label><input class="per_page_cat set_number" type="radio"
|
||||||
|
name="_apop_per_page[<?php echo esc_attr( $order ); ?>][<?php echo esc_attr( $custom_post_datum ); ?>]"
|
||||||
|
value=""<?php echo esc_attr( $per_page_data['_checked'] ); ?>><?php _e( 'Set the number posts', APOP_DOMAIN ); ?>
|
||||||
|
<input class="per_page_cat_input" type="text"
|
||||||
|
name="_apop_per_page[<?php echo esc_attr( $order ); ?>][<?php echo esc_attr( $custom_post_datum ); ?>]"
|
||||||
|
value="<?php echo esc_attr( $per_page_data['_per_page_num'] ); ?>"
|
||||||
|
required>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<?php endif;
|
||||||
+6
-2
@@ -9,13 +9,16 @@ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
|||||||
$param_settings = array(
|
$param_settings = array(
|
||||||
'_apop_normal_order_param',
|
'_apop_normal_order_param',
|
||||||
'_apop_search_order_param',
|
'_apop_search_order_param',
|
||||||
'_apop_tax_order_param',
|
|
||||||
'_apop_tax_sort_type',
|
|
||||||
'_apop_normal_order',
|
'_apop_normal_order',
|
||||||
'_apop_search_order',
|
'_apop_search_order',
|
||||||
|
'_apop_tax_order_param',
|
||||||
|
'_apop_tax_sort_type',
|
||||||
'_apop_cat_order',
|
'_apop_cat_order',
|
||||||
'_apop_tag_order',
|
'_apop_tag_order',
|
||||||
'_apop_tax_order',
|
'_apop_tax_order',
|
||||||
|
'_apop_custompost_archive_order_param',
|
||||||
|
'_apop_custompost_archive_sort_type',
|
||||||
|
'_apop_custompost_archive_order',
|
||||||
'_apop_per_page',
|
'_apop_per_page',
|
||||||
);
|
);
|
||||||
foreach ( $param_settings as $param_setting ) {
|
foreach ( $param_settings as $param_setting ) {
|
||||||
@@ -37,6 +40,7 @@ $tax_order_settings = array(
|
|||||||
'_apop_post_category_',
|
'_apop_post_category_',
|
||||||
'_apop_post_post_tag_',
|
'_apop_post_post_tag_',
|
||||||
'_apop_post_tax_',
|
'_apop_post_tax_',
|
||||||
|
'_apop_customposts_',
|
||||||
'_apop_postorder_'
|
'_apop_postorder_'
|
||||||
);
|
);
|
||||||
foreach ( $tax_order_settings as $tax_order_setting ) {
|
foreach ( $tax_order_settings as $tax_order_setting ) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ if ( ! trait_exists( 'CUSTOMFIELD_SELECT' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function set_custom_field() {
|
public function set_custom_field() {
|
||||||
$param = filter_input( INPUT_GET, 'param', FILTER_SANITIZE_STRING );
|
$param = filter_input( INPUT_GET, 'param', FILTER_DEFAULT );
|
||||||
echo json_encode( $this->get_custom_fields_by_param( $param ) );
|
echo json_encode( $this->get_custom_fields_by_param( $param ) );
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,148 @@
|
|||||||
|
<?php
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
} // Exit if accessed directly
|
||||||
|
|
||||||
|
if ( ! trait_exists( 'CUSTOMPOSTS' ) ) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* カスタム投稿アーカイブのソート
|
||||||
|
* Trait CUSTOMPOSTS
|
||||||
|
*/
|
||||||
|
trait CUSTOMPOSTS {
|
||||||
|
|
||||||
|
public static function get_enable_custompost_archive(): array {
|
||||||
|
$opt = get_option( '_apop_custompost_archive_order' );
|
||||||
|
if ( ! isset( $opt['target_post'] ) ) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
$custom_post_list = array();
|
||||||
|
foreach ( $opt['target_post'] as $target => $check ) {
|
||||||
|
if ( $check == '1' ) {
|
||||||
|
$custom_post_list[] = [
|
||||||
|
'label' => get_post_type_object( $target )->label,
|
||||||
|
'slug' => $target,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $custom_post_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function create_custompost_archive_order_list( $slug ): string {
|
||||||
|
$args = array(
|
||||||
|
'posts_per_page' => - 1,
|
||||||
|
'post_type' => array( $slug ),
|
||||||
|
'orderby' => 'meta_value_num',
|
||||||
|
'order' => 'ASC',
|
||||||
|
);
|
||||||
|
self::create_sort_post_list_meta_query( $args, '_apop_customposts_' . $slug );
|
||||||
|
$return_data = get_posts( $args );
|
||||||
|
$list = array();
|
||||||
|
foreach ( $return_data as $key => $target_post ) {
|
||||||
|
$sort_num = $key + 1;
|
||||||
|
$no_order = self::is_sort_custompost_archive_registered( $target_post->ID, $slug ) ? '' : ' no-order';
|
||||||
|
$list[] = '
|
||||||
|
<li class="product-list' . esc_attr( $no_order ) . '">' . '<span class="sort-num-label">' . esc_attr( $sort_num ) . '</span>' . get_the_title( $target_post->ID ) . '
|
||||||
|
<input type="hidden" class="list-order" name="_apop_customposts[' . esc_attr( $slug ) . '][' . esc_attr( $target_post->ID ) . ']" value="' . esc_attr( $sort_num ) . '">
|
||||||
|
</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode( PHP_EOL, $list );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static function is_sort_custompost_archive_registered( $id, $slug ): bool {
|
||||||
|
$post_meta = get_post_meta( $id, '_apop_customposts_' . $slug, true );
|
||||||
|
if ( ! empty( $post_meta ) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function create_custompost_archive_normal_list( $slug ) {
|
||||||
|
$name_keys = array(
|
||||||
|
'name_key' => 'apop_custompost_archive_order_param[' . $slug . ']',
|
||||||
|
'get_option_key' => '_apop_custompost_archive_order_param',
|
||||||
|
);
|
||||||
|
$name_key = $name_keys['name_key'];
|
||||||
|
$get_option_key = $name_keys['get_option_key'];
|
||||||
|
$order_param_base = get_option( $get_option_key );
|
||||||
|
$order_param = '';
|
||||||
|
if ( isset( $order_param_base[ $slug ] ) ) {
|
||||||
|
$order_param = $order_param_base[ $slug ];
|
||||||
|
}
|
||||||
|
self::create_normal_sort_list( $name_key, $order_param );
|
||||||
|
}
|
||||||
|
|
||||||
|
private function set_custompost_orderby( $query, $post_type ) {
|
||||||
|
$sort_type = get_option( '_apop_custompost_archive_sort_type' )[ $post_type ];
|
||||||
|
if ( $sort_type == 1 ) {
|
||||||
|
$sort_meta_key = self::set_custompost_sort_meta_key( $post_type );
|
||||||
|
if ( is_null( $sort_meta_key ) ) {
|
||||||
|
$this->set_search_normal_orderby( $query, 'custompost_archive' );
|
||||||
|
} else {
|
||||||
|
$query->set( 'meta_query', self::get_all_post_args( $sort_meta_key ) );
|
||||||
|
$query->set( 'orderby', array( 'meta_value' => 'ASC', ) );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$meta_orderby = self::set_custompost_custom_field_orderby( $post_type );
|
||||||
|
if ( isset( $meta_orderby['meta_query'] ) ) {
|
||||||
|
$query->set( 'meta_query', $meta_orderby['meta_query'] );
|
||||||
|
}
|
||||||
|
if ( isset( $meta_orderby['orderby'] ) ) {
|
||||||
|
$query->set( 'orderby', $meta_orderby['orderby'] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$per_page_option_data = self::set_custompost_per_page( $post_type );
|
||||||
|
$query->set( 'posts_per_page', $per_page_option_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function set_custompost_sort_meta_key( $post_type ) {
|
||||||
|
$order_settings = get_option( '_apop_custompost_archive_order' );
|
||||||
|
if ( isset( $order_settings['target_post'][ $post_type ] ) && $order_settings['target_post'][ $post_type ] == 1 ) {
|
||||||
|
return '_apop_customposts_' . $post_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function set_custompost_custom_field_orderby( $post_type ): array {
|
||||||
|
$order_param = get_option( '_apop_custompost_archive_order_param' );
|
||||||
|
if ( isset( $order_param[ $post_type ] ) ) {
|
||||||
|
return self::set_custom_field_orderby( $order_param[ $post_type ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function set_custompost_per_page( $post_type ) {
|
||||||
|
$per_page_option = get_option( '_apop_per_page' );
|
||||||
|
if ( ! $per_page_option ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! isset($per_page_option['custompost_archive'] ) ){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$per_page_option_data = $per_page_option['custompost_archive'][ $post_type ];
|
||||||
|
if ( ! isset( $per_page_option_data ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $per_page_option_data == 'default' ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $per_page_option_data == 'all' ) {
|
||||||
|
if ( $per_page_option['search'] == 'default' ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$per_page_option_data = $per_page_option['search'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $per_page_option_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+80
-194
@@ -12,6 +12,11 @@ if ( ! trait_exists( 'APOP_ORDER_SETTING' ) ) {
|
|||||||
add_action( 'pre_get_posts', array( $this, 'apop_posts_per_page' ), 1 );
|
add_action( 'pre_get_posts', array( $this, 'apop_posts_per_page' ), 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ソートのクエリを生成
|
||||||
|
*
|
||||||
|
* @param $query
|
||||||
|
*/
|
||||||
public function apop_posts_per_page( $query ) {
|
public function apop_posts_per_page( $query ) {
|
||||||
|
|
||||||
if ( is_admin() || ! $query->is_main_query() ) {
|
if ( is_admin() || ! $query->is_main_query() ) {
|
||||||
@@ -26,6 +31,13 @@ if ( ! trait_exists( 'APOP_ORDER_SETTING' ) ) {
|
|||||||
$this->set_search_normal_orderby( $query, 'search' );
|
$this->set_search_normal_orderby( $query, 'search' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( is_post_type_archive() ) {
|
||||||
|
$post_type = get_query_var( 'post_type' );
|
||||||
|
if ( $post_type ) {
|
||||||
|
$this->set_custompost_orderby( $query, $post_type );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( is_category() ) {
|
if ( is_category() ) {
|
||||||
$cat = get_category_by_slug( $query->query_vars['category_name'] );
|
$cat = get_category_by_slug( $query->query_vars['category_name'] );
|
||||||
if ( isset( $cat->term_id ) ) {
|
if ( isset( $cat->term_id ) ) {
|
||||||
@@ -47,33 +59,9 @@ if ( ! trait_exists( 'APOP_ORDER_SETTING' ) ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function set_per_page( $target, $id = null ) {
|
//-----------------------------------------------------------
|
||||||
$per_page_option = get_option( '_apop_per_page' );
|
// 最近の投稿と検索のソートのクエリ生成
|
||||||
|
//-----------------------------------------------------------
|
||||||
if(!$per_page_option){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( is_null( $id ) ) {
|
|
||||||
$per_page_option_data = $per_page_option[ $target ];
|
|
||||||
} else {
|
|
||||||
$per_page_target = $target == 'tax' ? 'taxonomy' : $target;
|
|
||||||
$per_page_option_data = $per_page_option[ $per_page_target ][ $id ];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! isset( $per_page_option_data ) ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( $per_page_option_data == 'default' ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( $per_page_option_data == 'all' ) {
|
|
||||||
$per_page_option_data = $per_page_option['search'];;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $per_page_option_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function set_search_normal_orderby( $query, $type ) {
|
private function set_search_normal_orderby( $query, $type ) {
|
||||||
$apop_order = get_option( '_apop_' . $type . '_order' ) ?? 1;
|
$apop_order = get_option( '_apop_' . $type . '_order' ) ?? 1;
|
||||||
if ( $apop_order == 2 ) {
|
if ( $apop_order == 2 ) {
|
||||||
@@ -93,98 +81,9 @@ if ( ! trait_exists( 'APOP_ORDER_SETTING' ) ) {
|
|||||||
$query->set( 'posts_per_page', $per_page_option_data );
|
$query->set( 'posts_per_page', $per_page_option_data );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function set_custom_filed_sort( &$orderby, $order_col, $orders, $sort_param ): array {
|
//-----------------------------------------------------------
|
||||||
if ( strpos( $order_col, 'custom_field' ) !== false ) {
|
//標準ソート+カスタムフィールドソートのカスタムフィールドデータ取得
|
||||||
if($orders['field']['custom_field_type'] == 2){
|
//-----------------------------------------------------------
|
||||||
$meta_key = APOP_CUSTOM_FIELD_PREFIX . $orders['field']['meta_key'];
|
|
||||||
}else{
|
|
||||||
$meta_key = $orders['field']['meta_key'];
|
|
||||||
}
|
|
||||||
$type = 'CHAR';
|
|
||||||
if ( $orders['field']['value_type'] == 'meta_value_num' ) {
|
|
||||||
$type = 'NUMERIC';
|
|
||||||
} elseif ( $orders['field']['value_type'] == 'meta_value' ) {
|
|
||||||
$type = 'CHAR';
|
|
||||||
} elseif ( $orders['field']['value_type'] == 'meta_date' ) {
|
|
||||||
$type = 'DATE';
|
|
||||||
}
|
|
||||||
if ( isset( $orders['sort'] ) ) {
|
|
||||||
$orderby[ $meta_key ] = $sort_param[ $orders['sort'] ];
|
|
||||||
}
|
|
||||||
|
|
||||||
return array( $meta_key, $type );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function set_orderby( $query, $id, $target, $order_key ) {
|
|
||||||
$sort_type = self::get_tax_sort_type( $id );
|
|
||||||
if ( $sort_type == 1 ) {
|
|
||||||
$sort_meta_key = self::set_tax_sort_meta_key( $id, $target, $order_key );
|
|
||||||
if ( is_null( $sort_meta_key ) ) {
|
|
||||||
$this->set_search_normal_orderby( $query, 'normal' );
|
|
||||||
} else {
|
|
||||||
$query->set( 'meta_query', self::get_all_post_args( $sort_meta_key ) );
|
|
||||||
$query->set( 'orderby', array( 'meta_value' => 'ASC', ) );
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$meta_orderby = self::set_tax_custom_field_orderby( $id );
|
|
||||||
if ( isset( $meta_orderby['meta_query'] ) ) {
|
|
||||||
$query->set( 'meta_query', $meta_orderby['meta_query'] );
|
|
||||||
}
|
|
||||||
if ( isset( $meta_orderby['orderby'] ) ) {
|
|
||||||
$query->set( 'orderby', $meta_orderby['orderby'] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$per_page_option_data = self::set_per_page( self::get_per_page_tag( $target ), $id );
|
|
||||||
$query->set( 'posts_per_page', $per_page_option_data );
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function get_tax_sort_type( $id ) {
|
|
||||||
$sort_type = get_option( '_apop_tax_sort_type' );
|
|
||||||
|
|
||||||
return $sort_type[ $id ] ?? 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function set_tax_sort_meta_key( $id, $target, $order_key ) {
|
|
||||||
$order_settings = get_option( '_apop_' . $order_key . '_order' );
|
|
||||||
if ( isset( $order_settings['target_cat'][ $id ] ) && $order_settings['target_cat'][ $id ] == 1 ) {
|
|
||||||
return '_apop_post_' . $target . '_' . $id;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function set_tax_custom_field_orderby( $id ): array {
|
|
||||||
$tax_order_param = get_option( '_apop_tax_order_param' );
|
|
||||||
if ( isset( $tax_order_param[ $id ] ) ) {
|
|
||||||
return self::set_custom_field_orderby( $tax_order_param[ $id ] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function get_per_page_tag( $target ) {
|
|
||||||
if ( $target == 'post_tag' ) {
|
|
||||||
return 'tag';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $target;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function get_all_post_args( $sort_meta_key, $type = 'numeric' ): array {
|
|
||||||
return array(
|
|
||||||
'relation' => 'OR',
|
|
||||||
array(
|
|
||||||
'key' => $sort_meta_key,
|
|
||||||
'compare' => 'EXISTS',
|
|
||||||
'type' => $type,
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'key' => $sort_meta_key,
|
|
||||||
'compare' => 'NOT EXISTS',
|
|
||||||
'type' => $type,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function set_custom_field_orderby( $apop_order_param ): array {
|
private static function set_custom_field_orderby( $apop_order_param ): array {
|
||||||
if ( ! $apop_order_param ) {
|
if ( ! $apop_order_param ) {
|
||||||
return array();
|
return array();
|
||||||
@@ -211,95 +110,82 @@ if ( ! trait_exists( 'APOP_ORDER_SETTING' ) ) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function set_custom_filed_sort( &$orderby, $order_col, $orders, $sort_param ): array {
|
||||||
/**
|
if ( strpos( $order_col, 'custom_field' ) !== false ) {
|
||||||
*
|
if ( $orders['field']['custom_field_type'] == 2 ) {
|
||||||
* 1ページ表示件数を取得する
|
$meta_key = APOP_CUSTOM_FIELD_PREFIX . $orders['field']['meta_key'];
|
||||||
* APOP::per_page(ID, [TARGET]);
|
|
||||||
* [TARGET]
|
|
||||||
* cat
|
|
||||||
* tag
|
|
||||||
* tax
|
|
||||||
*
|
|
||||||
* @param string $target
|
|
||||||
* @param null $id
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public static function per_page( $id = null, string $target = 'search' ) {
|
|
||||||
if ( $target == 'cat' ) {
|
|
||||||
$target = 'category';
|
|
||||||
}
|
|
||||||
|
|
||||||
return array( 'posts_per_page' => self::set_per_page( $target, $id ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最新の投稿ページのソートを取得する
|
|
||||||
* APOP::orderby_normal()
|
|
||||||
* @return array|null
|
|
||||||
*/
|
|
||||||
public static function orderby_normal() {
|
|
||||||
$apop_order = get_option( '_apop_normal_order' ) ?? 1;
|
|
||||||
if ( $apop_order == 2 ) {
|
|
||||||
return array(
|
|
||||||
'meta_query' => self::get_all_post_args( '_apop_normal_order' ),
|
|
||||||
'orderby' => array( 'meta_value_num' => 'ASC' ),
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
$apop_order_param = get_option( '_apop_normal_order_param' );
|
$meta_key = $orders['field']['meta_key'];
|
||||||
$meta_orderby = self::set_custom_field_orderby( $apop_order_param );
|
|
||||||
if ( is_null( $meta_orderby['meta_query'] ) ) {
|
|
||||||
unset( $meta_orderby['meta_query'] );
|
|
||||||
}
|
}
|
||||||
if ( is_null( $meta_orderby['orderby'] ) ) {
|
$type = 'CHAR';
|
||||||
unset( $meta_orderby['orderby'] );
|
if ( $orders['field']['value_type'] == 'meta_value_num' ) {
|
||||||
|
$type = 'NUMERIC';
|
||||||
|
} elseif ( $orders['field']['value_type'] == 'meta_value' ) {
|
||||||
|
$type = 'CHAR';
|
||||||
|
} elseif ( $orders['field']['value_type'] == 'meta_date' ) {
|
||||||
|
$type = 'DATE';
|
||||||
|
}
|
||||||
|
if ( isset( $orders['sort'] ) ) {
|
||||||
|
$orderby[ $meta_key ] = $sort_param[ $orders['sort'] ];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $meta_orderby;
|
return array( $meta_key, $type );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// ソートキーが無くともデータを抽出するようEXISTSとNOT EXISTSをリレーションする
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
private static function get_all_post_args( $sort_meta_key, $type = 'numeric' ): array {
|
||||||
|
return array(
|
||||||
|
'relation' => 'OR',
|
||||||
|
array(
|
||||||
|
'key' => $sort_meta_key,
|
||||||
|
'compare' => 'EXISTS',
|
||||||
|
'type' => $type,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'key' => $sort_meta_key,
|
||||||
|
'compare' => 'NOT EXISTS',
|
||||||
|
'type' => $type,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// 1ページ表示件数の取得
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
private static function set_per_page( $target, $id = null ) {
|
||||||
|
$per_page_option = get_option( '_apop_per_page' );
|
||||||
|
|
||||||
|
if ( ! $per_page_option ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
if ( is_null( $id ) ) {
|
||||||
* カテゴリー、タグ、カスタム分類のソートを取得する
|
$per_page_option_data = $per_page_option[ $target ];
|
||||||
* APOP::orderby_tax([ID, TARGET], );
|
|
||||||
* [TARGET]
|
|
||||||
* cat
|
|
||||||
* tag
|
|
||||||
* tax
|
|
||||||
*
|
|
||||||
* @param $id
|
|
||||||
* @param $target
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public static function orderby_tax( $id, $target ) {
|
|
||||||
$sort_type = self::get_tax_sort_type( $id );
|
|
||||||
if ( $sort_type == 1 ) {
|
|
||||||
$order_key = $target;
|
|
||||||
if ( $target == 'tag' ) {
|
|
||||||
$target == 'post_tag';
|
|
||||||
} elseif ( $target = 'cat' ) {
|
|
||||||
$target == 'category';
|
|
||||||
}
|
|
||||||
$sort_meta_key = self::set_tax_sort_meta_key( $id, $target, $order_key );
|
|
||||||
if ( is_null( $sort_meta_key ) ) {
|
|
||||||
return self::orderby_normal();
|
|
||||||
} else {
|
} else {
|
||||||
return array(
|
$per_page_target = $target == 'tax' ? 'taxonomy' : $target;
|
||||||
'meta_query' => self::get_all_post_args( $sort_meta_key ),
|
$per_page_option_data = $per_page_option[ $per_page_target ][ $id ];
|
||||||
'orderby' => array( 'meta_value_num' => 'ASC' ),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return self::set_tax_custom_field_orderby( $id );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! isset( $per_page_option_data ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( $per_page_option_data == 'default' ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $per_page_option_data == 'all' ) {
|
||||||
|
if ( $per_page_option['search'] == 'default' ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$per_page_option_data = $per_page_option['search'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $per_page_option_data;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
<?php
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
} // Exit if accessed directly
|
||||||
|
|
||||||
|
if ( ! trait_exists( 'APOP_OUTPUT' ) ) {
|
||||||
|
/**
|
||||||
|
* TODO: 出力用のコード
|
||||||
|
* Trait APOP_OUTPUT
|
||||||
|
*/
|
||||||
|
trait APOP_OUTPUT {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 1ページ表示件数を取得する
|
||||||
|
* APOP::per_page(ID, [TARGET]);
|
||||||
|
* [TARGET]
|
||||||
|
* cat
|
||||||
|
* tag
|
||||||
|
* tax
|
||||||
|
*
|
||||||
|
* @param string $target
|
||||||
|
* @param null $id
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function per_page( $id = null, string $target = 'search' ) {
|
||||||
|
if ( $target == 'cat' ) {
|
||||||
|
$target = 'category';
|
||||||
|
}
|
||||||
|
|
||||||
|
return array( 'posts_per_page' => self::set_per_page( $target, $id ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最新の投稿ページのソートを取得する
|
||||||
|
* APOP::orderby_normal()
|
||||||
|
* @return array|null
|
||||||
|
*/
|
||||||
|
public static function orderby_normal() {
|
||||||
|
$apop_order = get_option( '_apop_normal_order' ) ?? 1;
|
||||||
|
if ( $apop_order == 2 ) {
|
||||||
|
return array(
|
||||||
|
'meta_query' => self::get_all_post_args( '_apop_normal_order' ),
|
||||||
|
'orderby' => array( 'meta_value_num' => 'ASC' ),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$apop_order_param = get_option( '_apop_normal_order_param' );
|
||||||
|
$meta_orderby = self::set_custom_field_orderby( $apop_order_param );
|
||||||
|
if ( is_null( $meta_orderby['meta_query'] ) ) {
|
||||||
|
unset( $meta_orderby['meta_query'] );
|
||||||
|
}
|
||||||
|
if ( is_null( $meta_orderby['orderby'] ) ) {
|
||||||
|
unset( $meta_orderby['orderby'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $meta_orderby;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* カテゴリー、タグ、カスタム分類のソートを取得する
|
||||||
|
* APOP::orderby_tax([ID, TARGET], );
|
||||||
|
* [TARGET]
|
||||||
|
* cat
|
||||||
|
* tag
|
||||||
|
* tax
|
||||||
|
*
|
||||||
|
* @param $id
|
||||||
|
* @param $target
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function orderby_tax( $id, $target ) {
|
||||||
|
$sort_type = self::get_tax_sort_type( $id );
|
||||||
|
if ( $sort_type == 1 ) {
|
||||||
|
$order_key = $target;
|
||||||
|
if ( $target == 'tag' ) {
|
||||||
|
$target == 'post_tag';
|
||||||
|
} elseif ( $target = 'cat' ) {
|
||||||
|
$target == 'category';
|
||||||
|
}
|
||||||
|
$sort_meta_key = self::set_tax_sort_meta_key( $id, $target, $order_key );
|
||||||
|
if ( is_null( $sort_meta_key ) ) {
|
||||||
|
return self::orderby_normal();
|
||||||
|
} else {
|
||||||
|
return array(
|
||||||
|
'meta_query' => self::get_all_post_args( $sort_meta_key ),
|
||||||
|
'orderby' => array( 'meta_value_num' => 'ASC' ),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return self::set_tax_custom_field_orderby( $id );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
} // Exit if accessed directly
|
||||||
|
|
||||||
|
if ( ! trait_exists( 'TAX' ) ) {
|
||||||
|
/**
|
||||||
|
* タクソノミーのソート
|
||||||
|
* Trait TAX
|
||||||
|
*/
|
||||||
|
trait TAX {
|
||||||
|
private function set_orderby( $query, $id, $target, $order_key ) {
|
||||||
|
$sort_type = self::get_tax_sort_type( $id );
|
||||||
|
if ( $sort_type == 1 ) {
|
||||||
|
$sort_meta_key = self::set_tax_sort_meta_key( $id, $target, $order_key );
|
||||||
|
if ( is_null( $sort_meta_key ) ) {
|
||||||
|
$this->set_search_normal_orderby( $query, 'normal' );
|
||||||
|
} else {
|
||||||
|
$query->set( 'meta_query', self::get_all_post_args( $sort_meta_key ) );
|
||||||
|
$query->set( 'orderby', array( 'meta_value' => 'ASC', ) );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$meta_orderby = self::set_tax_custom_field_orderby( $id );
|
||||||
|
if ( isset( $meta_orderby['meta_query'] ) ) {
|
||||||
|
$query->set( 'meta_query', $meta_orderby['meta_query'] );
|
||||||
|
}
|
||||||
|
if ( isset( $meta_orderby['orderby'] ) ) {
|
||||||
|
$query->set( 'orderby', $meta_orderby['orderby'] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$per_page_option_data = self::set_per_page( self::get_per_page_tag( $target ), $id );
|
||||||
|
$query->set( 'posts_per_page', $per_page_option_data );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function get_tax_sort_type( $id ) {
|
||||||
|
$sort_type = get_option( '_apop_tax_sort_type' );
|
||||||
|
|
||||||
|
return $sort_type[ $id ] ?? 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function set_tax_sort_meta_key( $id, $target, $order_key ) {
|
||||||
|
$order_settings = get_option( '_apop_' . $order_key . '_order' );
|
||||||
|
if ( isset( $order_settings['target_cat'][ $id ] ) && $order_settings['target_cat'][ $id ] == 1 ) {
|
||||||
|
return '_apop_post_' . $target . '_' . $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function set_tax_custom_field_orderby( $id ): array {
|
||||||
|
$tax_order_param = get_option( '_apop_tax_order_param' );
|
||||||
|
if ( isset( $tax_order_param[ $id ] ) ) {
|
||||||
|
return self::set_custom_field_orderby( $tax_order_param[ $id ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function get_per_page_tag( $target ) {
|
||||||
|
if ( $target == 'post_tag' ) {
|
||||||
|
return 'tag';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $target;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user