WP PLUGIN 

・選択カスタムフィールドをオートコンプリートに変更
・ソート対象名:「通常」から「最新の投稿」に変更
This commit is contained in:
2021-06-27 18:57:34 +09:00
parent 49087f4950
commit 8ec3d53bfe
10 changed files with 37 additions and 22 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ Plugin Name: Archive Post Order Plus
Plugin URI: https://develop.n-k-y.net/wordpress/wp_plugin/apop/ 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: 通常表示、検索表示、タクソノミー毎に投稿表示順を設定するプラグイン Description: 「最新の投稿」「検索結果」「カテゴリー」「タグ」「カスタム分類」の投稿表示順を設定するプラグイン
Version: 1.1.3 Version: 1.1.3
License: GPLv2 License: GPLv2
*/ */
+3 -3
View File
@@ -38,7 +38,7 @@ if ( ! class_exists( 'APOP_POST' ) ) {
} }
public function insert_meta_fields() { public function insert_meta_fields() {
//通常ソート //最新の投稿ソート
if ( get_option( '_apop_normal_order' ) == '1' ) { if ( get_option( '_apop_normal_order' ) == '1' ) {
$this->create_order_field_data( get_option( '_apop_normal_order_param' ), 'normal' ); $this->create_order_field_data( get_option( '_apop_normal_order_param' ), 'normal' );
} }
@@ -50,7 +50,7 @@ if ( ! class_exists( 'APOP_POST' ) ) {
$this->create_order_tax_field_data( get_option( '_apop_tax_order_param' ) ); $this->create_order_tax_field_data( get_option( '_apop_tax_order_param' ) );
$this->labels = array( $this->labels = array(
'normal' => '通常', 'normal' => '最新の投稿',
'search' => '検索', 'search' => '検索',
'tax' => 'カテゴリー、タグ、カスタム分類', 'tax' => 'カテゴリー、タグ、カスタム分類',
); );
@@ -139,7 +139,7 @@ if ( ! class_exists( 'APOP_POST' ) ) {
} }
private function get_update_meta_fields() { private function get_update_meta_fields() {
//通常ソート //最新の投稿ソート
$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 );
+1
View File
@@ -365,6 +365,7 @@ value="' . esc_html( $sort_num ) . '">
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="sort-custom-field-inner"> <div class="sort-custom-field-inner">
<div class="sort-custom-field-inner-label">値タイプ:</div> <div class="sort-custom-field-inner-label">値タイプ:</div>
<label class="sort-custom-field-text-label"> <label class="sort-custom-field-text-label">
+1 -1
View File
@@ -72,7 +72,7 @@ if ( ! class_exists( 'APOP' ) ) {
public function show_option_page() { public function show_option_page() {
//------------------------------------- //-------------------------------------
// 通常表示 // 最新の投稿表示
// ------------------------------------ // ------------------------------------
$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' );
+7
View File
@@ -295,6 +295,13 @@ dl.apop-setting-list-dd .sort-custom-field-input {
margin: .5em 0; margin: .5em 0;
} }
.custom-field-select-alert {
width: 100%;
margin-top: -.5em;
color: crimson;
text-align: right;
}
@media only screen and (max-width: 1264px) { @media only screen and (max-width: 1264px) {
.enable-box .product-list, .enable-box .product-list,
.disable-box .product-list { .disable-box .product-list {
+2
View File
@@ -225,9 +225,11 @@ jQuery(function ($) {
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('既存のカスタムフィールドから選択');
} 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('APOP専用カスタムフィールドを追加');
} }
} }
} }
+17 -12
View File
@@ -1,6 +1,6 @@
=== Archive Post Order Plus === === Archive Post Order Plus ===
Contributors: nbk45 Contributors: nbk45
Tags: 投稿,表示順,投稿表示順,カテゴリー,タグ,カスタム分類,post,archive,category,tag,custom taxonomy,order Tags: latest posts order,categories post order,tags post order,custom taxonomy post order
Requires at least: 4.9 Requires at least: 4.9
Tested up to: 5.7.2 Tested up to: 5.7.2
Requires PHP: 7.0 Requires PHP: 7.0
@@ -8,25 +8,31 @@ Stable tag: 1.1.3
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
投稿の表示順を通常とタクソノミー毎に設定するプラグイン。 投稿の表示順を設定するプラグイン。
== Description == == Description ==
このプラグインは通常表示とタクソノミー毎に投稿表示順を設定するプラグインです。 このプラグインは、下記の投稿表示順をカスタマイズするプラグインです。
・[設定]-[表示設定]の「最新の投稿」
・検索結果
・カテゴリー
・タグ
・カスタム分類
= 仕様 = = 仕様 =
カスタマイズしたいカテゴリー、タグ、カスタム分類毎に投稿表示順を設定可能にします。 [設定]-[表示設定]の「最新の投稿」、検索結果、カテゴリー、タグ、カスタム分類毎に投稿表示順を設定可能にします。
表示順は 1通常+カスタムフィールドソート、2)ドラッグソートのどちら選択可能です。 表示順は 1標準+カスタムフィールドソート、2)ドラッグソートのどちら選択します。
1通常+カスタムフィールドソート 1標準+カスタムフィールドソート
投稿の更新日、ID、タイトル、登録日のソートに加え、4つのカスタムフィールドが登録可能です。 投稿の更新日、ID、タイトル、登録日に加え、4つのカスタムフィールド(※)が登録可能です。
有効にしたい項目を選択しドラッグで順番を設定します。 有効にしたい項目を選択しドラッグで順番を設定します。
カスタムフィールドは、既存のカスタムフィールドから選択もしくは本プラグイン用に追加可能。 ※)カスタムフィールドは、既存のカスタムフィールドから選択もしくは本プラグイン用に追加可能です
(追加の場合は各投稿の専用入力フォームから登録) (追加の場合は各投稿の専用入力フォームから登録します
※)本プラグインの削除時は、追加したカスタムフィールドも削除されます
2)ドラッグソート 2)ドラッグソート
カテゴリー、タグ、カスタム分類に属する投稿表示順をドラッグで設定します。 リスト表示されてた投稿一覧で、投稿をドラッグし表示順を設定します。
== Installation == == Installation ==
@@ -43,7 +49,6 @@ License URI: https://www.gnu.org/licenses/gpl-2.0.html
== Frequently Asked Questions == == Frequently Asked Questions ==
== Screenshots == == Screenshots ==
screenshot-1.png screenshot-1.png
screenshot-2.png screenshot-2.png
+2 -2
View File
@@ -5,7 +5,7 @@ $submit_type = APOP_UI::input_post_filter( 'apop_submit_type', 'str' );
<h2>並べ替え</h2> <h2>並べ替え</h2>
<nav class="post-order-nav"> <nav class="post-order-nav">
<ul> <ul>
<li class="en">通常</li> <li class="en">最新の投稿</li>
<li>検索</li> <li>検索</li>
<li>カテゴリー</li> <li>カテゴリー</li>
<li>タグ</li> <li>タグ</li>
@@ -20,7 +20,7 @@ $submit_type = APOP_UI::input_post_filter( 'apop_submit_type', 'str' );
<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">
<h3>通常</h3> <h3>最新の投稿(設定-表示設定ーホームページの表示)</h3>
<?php <?php
$order_target_type = '_apop_normal_order'; $order_target_type = '_apop_normal_order';
$order_target = APOP_UI::get_order_type( $order_target_type ); $order_target = APOP_UI::get_order_type( $order_target_type );
+2 -2
View File
@@ -5,7 +5,7 @@ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
die; die;
} }
//通常と検索の表示件数、ソート対象設定等を削除 //最新の投稿と検索の表示件数、ソート対象設定等を削除
$param_settings = array( $param_settings = array(
'_apop_normal_order_param', '_apop_normal_order_param',
'_apop_search_order_param', '_apop_search_order_param',
@@ -24,7 +24,7 @@ foreach ( $param_settings as $param_setting ) {
global $wpdb; global $wpdb;
//通常と検索用のカスタム表示順を削除 //最新の投稿と検索用のカスタム表示順を削除
$option_orders = array( $option_orders = array(
"'" . '_apop_post_normal' . "'", "'" . '_apop_post_normal' . "'",
"'" . '_apop_post_search' . "'", "'" . '_apop_post_search' . "'",
+1 -1
View File
@@ -231,7 +231,7 @@ if ( ! trait_exists( 'APOP_ORDER_SETTING' ) ) {
/** /**
* 通常ページのソートを取得する * 最新の投稿ページのソートを取得する
* APOP::orderby_normal() * APOP::orderby_normal()
* @return array|null * @return array|null
*/ */