diff --git a/archive-post-order-plus.php b/archive-post-order-plus.php
index 126b9d7..5bd1b21 100644
--- a/archive-post-order-plus.php
+++ b/archive-post-order-plus.php
@@ -5,7 +5,7 @@ Plugin URI: https://develop.n-k-y.net/wordpress/wp_plugin/apop/
Author: NBK45
Author URI: https://develop.n-k-y.net
Description: Archive Post Order Plus は「最新の投稿」「検索結果」「カテゴリー」「タグ」「カスタム分類」の投稿記事の表示順をドラッグで並べ替えて設定するプラグインです。
-Version: 1.2.0
+Version: 1.2.1
License: GPLv2
Text Domain: ArchivePostOrderPlus
Domain Path: /languages
diff --git a/class/class.apop.apop_ui.php b/class/class.apop.apop_ui.php
index 5b00fe6..d7b7f1f 100644
--- a/class/class.apop.apop_ui.php
+++ b/class/class.apop.apop_ui.php
@@ -1,519 +1,520 @@
$post_data ) {
- $order = $i + 1;
- $no_order = self::is_sort_post_registered( $post_data->ID, $meta_key ) ? '' : ' no-order';
- echo '
+ private static function create_custom_field_sort_type($name_key, $target_key, $cnv_order_params) {
+ $meta_key = $cnv_order_params[$target_key]['meta_key'];
+ $value_type = $cnv_order_params[$target_key]['value_type'];
+ $custom_field_type = $cnv_order_params[$target_key]['custom_field_type'];
+ $name_meta_key = '_' . $name_key . '[' . $target_key . '][field][meta_key]';
+ $name_value_type = '_' . $name_key . '[' . $target_key . '][field][value_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_2 = $custom_field_type == '2' ? $meta_key : '';
+ echo '
-
' . __( 'Type', APOP_DOMAIN ) . ':
+
' . __('Type', APOP_DOMAIN) . ':
+ name="' . esc_attr($name_value_type) . '"
+ value="meta_value"' . esc_attr(self::set_search_normal_checked($value_type, 'meta_value')) . '>' . __('Text', APOP_DOMAIN) . '
+ name="' . esc_attr($name_value_type) . '"
+ value="meta_value_num"' . esc_attr(self::set_search_normal_checked($value_type, 'meta_value_num')) . '>' . __('Number', APOP_DOMAIN) . '
';
- }
+ }
- private static function set_order_list_param( $order_param, $target_key ): array {
+ private static function set_order_list_param($order_param, $target_key): array {
- $param = array(
- 'use' => 0,
- 'sort' => 2,
- 'no_order_class' => ' no-order',
- );
+ $param = array(
+ 'use' => 0,
+ 'sort' => 2,
+ 'no_order_class' => ' no-order',
+ );
- if ( strpos( $target_key, 'custom_field' ) !== false ) {
- $param[ $target_key ] = array(
- 'meta_key' => '',
- 'value_type' => 'meta_value',
- 'custom_field_type' => '1',
- );
- }
+ if (strpos($target_key, 'custom_field') !== false) {
+ $param[$target_key] = array(
+ 'meta_key' => '',
+ 'value_type' => 'meta_value',
+ 'custom_field_type' => '1',
+ );
+ }
- if ( isset( $order_param[ $target_key ] ) ) {
- $param = array(
- 'use' => $order_param[ $target_key ]['use'] ?? 0,
- 'sort' => $order_param[ $target_key ]['sort'] ?? 2,
- 'no_order_class' => ! $order_param[ $target_key ]['use'] ? ' no-order' : '',
- );
- if ( strpos( $target_key, 'custom_field' ) !== false ) {
- $param[ $target_key ] = array(
- 'meta_key' => $order_param[ $target_key ]['field']['meta_key'] ?? '',
- 'value_type' => $order_param[ $target_key ]['field']['value_type'] ?? 'meta_value',
- 'custom_field_type' => $order_param[ $target_key ]['field']['custom_field_type'] ?? '1',
- );
- }
- }
+ if (isset($order_param[$target_key])) {
+ $param = array(
+ 'use' => $order_param[$target_key]['use'] ?? 0,
+ 'sort' => $order_param[$target_key]['sort'] ?? 2,
+ 'no_order_class' => !$order_param[$target_key]['use'] ? ' no-order' : '',
+ );
+ if (strpos($target_key, 'custom_field') !== false) {
+ $param[$target_key] = array(
+ 'meta_key' => $order_param[$target_key]['field']['meta_key'] ?? '',
+ 'value_type' => $order_param[$target_key]['field']['value_type'] ?? 'meta_value',
+ 'custom_field_type' => $order_param[$target_key]['field']['custom_field_type'] ?? '1',
+ );
+ }
+ }
- return $param;
+ return $param;
- }
+ }
- private static function create_name_keys( $id, $type ): array {
- if ( is_null( $id ) ) {
- return array(
- 'name_key' => 'apop_' . $type . '_order_param',
- 'get_option_key' => '_' . 'apop_' . $type . '_order_param',
- );
- } else {
- return array(
- 'name_key' => 'apop_tax_order_param[' . $id . ']',
- 'get_option_key' => '_apop_tax_order_param',
- );
- }
- }
+ private static function create_name_keys($id, $type): array {
+ if (is_null($id)) {
+ return array(
+ 'name_key' => 'apop_' . $type . '_order_param',
+ 'get_option_key' => '_' . 'apop_' . $type . '_order_param',
+ );
+ } else {
+ return array(
+ 'name_key' => 'apop_tax_order_param[' . $id . ']',
+ 'get_option_key' => '_apop_tax_order_param',
+ );
+ }
+ }
- 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(
- 'date',
- 'title',
- 'ID',
- 'modified',
- 'custom_field',
- 'custom_field_2',
- 'custom_field_3',
- 'custom_field_4',
- );
+ $set_keys = array(
+ 'date',
+ 'title',
+ 'ID',
+ 'modified',
+ 'custom_field',
+ 'custom_field_2',
+ 'custom_field_3',
+ 'custom_field_4',
+ );
- if ( $post_apop_search_order_param ) {
- $register_keys = array_keys( $post_apop_search_order_param );
+ if ($post_apop_search_order_param) {
+ $register_keys = array_keys($post_apop_search_order_param);
- return array_unique( array_merge( $register_keys, $set_keys ) );
- }
+ return array_unique(array_merge($register_keys, $set_keys));
+ }
- return $set_keys;
- }
+ return $set_keys;
+ }
- private static function set_search_normal_checked( $param, $default ): string {
- if ( $param == $default ) {
- return ' checked="checked"';
- }
+ private static function set_search_normal_checked($param, $default): string {
+ if ($param == $default) {
+ return ' checked="checked"';
+ }
+ return '';
+ }
- return '';
- }
+ public static function input_post_filter($var_name, $type) {
+ if ($type == 'array') {
+ return filter_input(INPUT_POST, $var_name, FILTER_SANITIZE_STRING, FILTER_REQUIRE_ARRAY);
+ }
+ if ($type == 'str') {
+ return filter_input(INPUT_POST, $var_name, FILTER_SANITIZE_STRING);
+ }
+ return '';
+ }
- public static function input_post_filter( $var_name, $type ) {
- if ( $type == 'array' ) {
- return filter_input( INPUT_POST, $var_name, FILTER_SANITIZE_STRING, FILTER_REQUIRE_ARRAY );
- }
- if ( $type == 'str' ) {
- return filter_input( INPUT_POST, $var_name, FILTER_SANITIZE_STRING );
- }
- }
+ 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';
+ }
- 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 '
- ' . esc_attr( $target_values[ $target_key ] ) . '
+ echo '
+ ' . esc_attr($target_values[$target_key]) . '
+ name="' . esc_attr($name_sort_key) . '"
+ value="1"' . esc_attr(self::set_search_normal_checked($sort, 1)) . '>' . __('Asc', APOP_DOMAIN) . '
';
+ name="' . esc_attr($name_sort_key) . '"
+ value="2"' . esc_attr(self::set_search_normal_checked($sort, 2)) . '>' . __('Desc', APOP_DOMAIN) . '';
- if ( strpos( $target_key, 'custom_field' ) !== false ) {
- self::create_custom_field_sort_type( $name_key, $target_key, $cnv_order_params );
- }
+ if (strpos($target_key, 'custom_field') !== false) {
+ self::create_custom_field_sort_type($name_key, $target_key, $cnv_order_params);
+ }
- echo '
+ echo '
';
- }
- }
+ }
+ }
- }
+ }
}
\ No newline at end of file
diff --git a/readme.txt b/readme.txt
index 5580803..819db80 100644
--- a/readme.txt
+++ b/readme.txt
@@ -2,9 +2,9 @@
Contributors: nbk45
Tags: latest posts order,categories post order,tags post order,custom taxonomy post order
Requires at least: 4.9
-Tested up to: 5.9
-Requires PHP: 7.0
-Stable tag: 1.2.0
+Tested up to: 6.0
+Requires PHP: 7.4
+Stable tag: 1.2.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -82,6 +82,19 @@ screenshot-7.png
screenshot-8.png
== Changelog ==
+= 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.