WP PLUGIN 申請指摘事項の修正
・$_POSTのサニタイズ ・echoのエスケープ ・readmeの修正
This commit is contained in:
@@ -4,8 +4,8 @@ Plugin Name: Archive Post Order Plus
|
|||||||
Plugin URI: https://www.n-k-y.net/wp_plugin_apop/
|
Plugin URI: https://www.n-k-y.net/wp_plugin_apop/
|
||||||
Author: Nobuhiro Kimura
|
Author: Nobuhiro Kimura
|
||||||
Author URI: https://www.n-k-y.net
|
Author URI: https://www.n-k-y.net
|
||||||
Description: アーカイブのタクソノミー毎に投稿の表示順を設定するプラグイン
|
Description: 通常表示、検索表示、タクソノミー毎に投稿の表示順を設定するプラグイン
|
||||||
Version: 1.0.0
|
Version: 1.0.1
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -35,8 +35,8 @@ $APOP = new APOP;
|
|||||||
new APOP_POST;
|
new APOP_POST;
|
||||||
|
|
||||||
//CSS, JSの読み込み
|
//CSS, JSの読み込み
|
||||||
add_action( 'admin_enqueue_scripts', 'register_my_styles' );
|
add_action( 'admin_enqueue_scripts', 'mtee_register_my_styles' );
|
||||||
function register_my_styles() {
|
function mtee_register_my_styles() {
|
||||||
wp_enqueue_style( 'hrc_post_style', APOP_PLUGIN_URL . 'css/apop-style.css' );
|
wp_enqueue_style( 'hrc_post_style', APOP_PLUGIN_URL . 'css/apop-style.css' );
|
||||||
wp_enqueue_script( 'jquery-ui-sortable' );
|
wp_enqueue_script( 'jquery-ui-sortable' );
|
||||||
wp_enqueue_script( 'post-sort-cat-order_js', APOP_PLUGIN_URL . 'js/apop-style.js' );
|
wp_enqueue_script( 'post-sort-cat-order_js', APOP_PLUGIN_URL . 'js/apop-style.js' );
|
||||||
|
|||||||
@@ -119,8 +119,7 @@ if ( ! class_exists( 'APOP_POST' ) ) {
|
|||||||
if ( count( $this->name_keys ) > 0 ) {
|
if ( count( $this->name_keys ) > 0 ) {
|
||||||
foreach ( $this->name_keys as $name_key ) {
|
foreach ( $this->name_keys as $name_key ) {
|
||||||
$save_key = APOP_CUSTOM_FIELD_PREFIX . $name_key;
|
$save_key = APOP_CUSTOM_FIELD_PREFIX . $name_key;
|
||||||
update_post_meta( $post_id, $save_key, $_POST[ $save_key ] ?? '' );
|
update_post_meta( $post_id, $save_key, APOP_UI::input_post_filter( $save_key, 'str' ) );
|
||||||
update_post_meta( $post_id, $save_key, $_POST[ $save_key ] ?? '' );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -433,10 +433,10 @@ value="meta_value_num"' . self::set_search_normal_checked( $value_type, 'meta_va
|
|||||||
|
|
||||||
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_DEFAULT, FILTER_REQUIRE_ARRAY );
|
return filter_input( INPUT_POST, $var_name, FILTER_SANITIZE_STRING, FILTER_REQUIRE_ARRAY );
|
||||||
}
|
}
|
||||||
if ( $type == 'str' ) {
|
if ( $type == 'str' ) {
|
||||||
return filter_input( INPUT_POST, $var_name );
|
return filter_input( INPUT_POST, $var_name, FILTER_SANITIZE_STRING );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -134,6 +134,10 @@ dl.apop_setting_list_dd dd input {
|
|||||||
border-bottom: 1px solid #ccc;
|
border-bottom: 1px solid #ccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.drag_sort .product-list {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
.enable_box .product-list {
|
.enable_box .product-list {
|
||||||
padding: 1em 0;
|
padding: 1em 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+28
-23
@@ -1,56 +1,61 @@
|
|||||||
=== Archive POst Order Plus ===
|
=== Archive Post Order Plus ===
|
||||||
Contributors: nbk45
|
Contributors: nbk45
|
||||||
Tags: 投稿,表示順,投稿表示順,カテゴリー,タグ,カスタム分類,post,archive,category,tag,custom taxonomy,order
|
Tags: 投稿,表示順,投稿表示順,カテゴリー,タグ,カスタム分類,post,archive,category,tag,custom taxonomy,order
|
||||||
Requires at least: 4.9
|
Requires at least: 4.9
|
||||||
Tested up to: 5.7
|
Tested up to: 5.7.2
|
||||||
Requires PHP: 7.0
|
Requires PHP: 7.0
|
||||||
Stable tag: 1.0.0
|
Stable tag: 1.0.1
|
||||||
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)通常+カスタムフィールドソート
|
||||||
|
投稿の更新日、ID、タイトル、登録日のソートに加え、4つのカスタムフィールドが登録可能です。
|
||||||
|
有効にしたい項目を選択し、ドラッグで順番を設定します。
|
||||||
|
|
||||||
|
2)ドラッグソート
|
||||||
|
カテゴリー、タグ、カスタム分類に属する投稿表示順をドラッグで設定します。
|
||||||
|
|
||||||
【サブクエリコード】
|
|
||||||
get_posts()などを利用する場合、下記のコードに並び順のパラメータを取得できます。
|
|
||||||
<pre><code>
|
|
||||||
<?php
|
|
||||||
?>
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
== Installation ==
|
== Installation ==
|
||||||
|
|
||||||
= 自動インストール =
|
= 自動インストール =
|
||||||
1. プラグインの検索フィールドより「Archive Post Order Plus」や「投稿表示順」と入力し、"プラグインの検索"をクリックします。
|
1. プラグインの検索フィールドより「Archive Post Order Plus」と入力し、"プラグインの検索"をクリックします。
|
||||||
1. 当プラグインを見つけたら、"今すぐインストール"をクリックしてインストールし、プラグインを有効化してください。
|
2. 当プラグインを見つけたら、"今すぐインストール"をクリックしてインストールし、プラグインを有効化してください。
|
||||||
|
|
||||||
= 手動インストール =
|
= 手動インストール =
|
||||||
1. プラグインをダウンロードします。
|
1. プラグインをダウンロードします。
|
||||||
1. プラグインフォルダ内にアップロードし、管理画面よりプラグインを有効化してください。
|
2. プラグインフォルダ内にアップロードし、管理画面よりプラグインを有効化してください。
|
||||||
|
|
||||||
|
|
||||||
== Frequently Asked Questions ==
|
== Frequently Asked Questions ==
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
== Screenshots ==
|
== Screenshots ==
|
||||||
|
|
||||||
1. /assets/screenshot-1.png
|
|
||||||
2. /assets/screenshot-2.png
|
|
||||||
3. /assets/screenshot-3.png
|
|
||||||
4. /assets/screenshot-4.png
|
|
||||||
5. /assets/screenshot-5.png
|
|
||||||
6. /assets/screenshot-6.png
|
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
= 1.0.0 =
|
= 1.0.0 =
|
||||||
Initial working version.
|
初回リリース
|
||||||
|
|
||||||
|
= 1.0.1 =
|
||||||
|
関数名の修正と$_POSTのサニタイズとHTML出力のエスケープ
|
||||||
|
|
||||||
|
|
||||||
== Upgrade Notice ==
|
== Upgrade Notice ==
|
||||||
No information
|
No information
|
||||||
|
|
||||||
|
|
||||||
|
== Arbitrary section ==
|
||||||
+2
-2
@@ -42,7 +42,7 @@ $submit_type = APOP_UI::input_post_filter( 'apop_submit_type', 'str' );
|
|||||||
</div>
|
</div>
|
||||||
<div class="sort_box">
|
<div class="sort_box">
|
||||||
<?php echo APOP_UI::none_registered_alert_msg(); ?>
|
<?php echo APOP_UI::none_registered_alert_msg(); ?>
|
||||||
<ul class="post-order-list">
|
<ul class="post-order-list drag_sort">
|
||||||
<?php echo APOP_UI::get_all_search_normal_posts( 'normal' ); ?>
|
<?php echo APOP_UI::get_all_search_normal_posts( 'normal' ); ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -75,7 +75,7 @@ $submit_type = APOP_UI::input_post_filter( 'apop_submit_type', 'str' );
|
|||||||
</div>
|
</div>
|
||||||
<div class="sort_box">
|
<div class="sort_box">
|
||||||
<?php echo APOP_UI::none_registered_alert_msg(); ?>
|
<?php echo APOP_UI::none_registered_alert_msg(); ?>
|
||||||
<ul class="post-order-list">
|
<ul class="post-order-list drag_sort">
|
||||||
<?php echo APOP_UI::get_all_search_normal_posts( 'search' ); ?>
|
<?php echo APOP_UI::get_all_search_normal_posts( 'search' ); ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<?php if ( isset( $order_target, $order_target_type ) ): ?>
|
<?php if ( isset( $order_target, $order_target_type ) ): ?>
|
||||||
<ul class="sort_menu_list"
|
<ul class="sort_menu_list"
|
||||||
data-order_target="<?php echo $order_target; ?>">
|
data-order_target="<?php echo esc_html($order_target); ?>">
|
||||||
<li><label>
|
<li><label>
|
||||||
<input class="sort_menu" type="radio" name="<?php echo $order_target_type; ?>"
|
<input class="sort_menu" type="radio" name="<?php echo esc_html($order_target_type); ?>"
|
||||||
value="1"<?php checked( $order_target, 1 ); ?>>標準+カスタムフィールドソート</label></li>
|
value="1"<?php checked( $order_target, 1 ); ?>>標準+カスタムフィールドソート</label></li>
|
||||||
<li><label>
|
<li><label>
|
||||||
<input class="sort_menu" type="radio" name="<?php echo $order_target_type; ?>"
|
<input class="sort_menu" type="radio" name="<?php echo esc_html($order_target_type); ?>"
|
||||||
value="2"<?php checked( $order_target, 2 ); ?>>ドラッグソート</label></li>
|
value="2"<?php checked( $order_target, 2 ); ?>>ドラッグソート</label></li>
|
||||||
</ul>
|
</ul>
|
||||||
<?php endif;
|
<?php endif;
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
<?php echo APOP_UI::none_registered_alert_msg(); ?>
|
<?php echo APOP_UI::none_registered_alert_msg(); ?>
|
||||||
<?php foreach ( $tax_list as $tax_data ): ?>
|
<?php foreach ( $tax_list as $tax_data ): ?>
|
||||||
<div class="list-orders-inner">
|
<div class="list-orders-inner">
|
||||||
<h3><?php echo $tax_data->name; ?></h3>
|
<h3><?php echo esc_html($tax_data->name); ?></h3>
|
||||||
<?php
|
<?php
|
||||||
$order_target_data = get_option( '_apop_tax_sort_type' );
|
$order_target_data = get_option( '_apop_tax_sort_type' );
|
||||||
if ( isset( $order_target_data[ $tax_data->term_id ] ) ) {
|
if ( isset( $order_target_data[ $tax_data->term_id ] ) ) {
|
||||||
@@ -15,23 +15,23 @@
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<ul class="sort_menu_list"
|
<ul class="sort_menu_list"
|
||||||
data-order_target="<?php echo $order_target; ?>">
|
data-order_target="<?php echo esc_html($order_target); ?>">
|
||||||
<li>
|
<li>
|
||||||
<label>
|
<label>
|
||||||
<input class="sort_menu" type="radio"
|
<input class="sort_menu" type="radio"
|
||||||
name="_apop_tax_sort_type[<?php echo $tax_data->term_id; ?>]"
|
name="_apop_tax_sort_type[<?php echo esc_html($tax_data->term_id); ?>]"
|
||||||
value="1"<?php checked( $order_target, 1 ); ?>>ドラッグソート</label>
|
value="1"<?php checked( $order_target, 1 ); ?>>ドラッグソート</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label>
|
<label>
|
||||||
<input class="sort_menu" type="radio"
|
<input class="sort_menu" type="radio"
|
||||||
name="_apop_tax_sort_type[<?php echo $tax_data->term_id; ?>]"
|
name="_apop_tax_sort_type[<?php echo esc_html($tax_data->term_id); ?>]"
|
||||||
value="2"<?php checked( $order_target, 2 ); ?>>標準+カスタムフィールドソート</label>
|
value="2"<?php checked( $order_target, 2 ); ?>>標準+カスタムフィールドソート</label>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="sort_box">
|
<div class="sort_box">
|
||||||
<ul class="post-order-list">
|
<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 ); ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<label>
|
<label>
|
||||||
<input class="per_page_search" type="radio" name="_apop_per_page[search]"
|
<input class="per_page_search" type="radio" name="_apop_per_page[search]"
|
||||||
value="default"<?php checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う(<?php echo $default_per_page; ?>
|
value="default"<?php checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う(<?php echo esc_html($default_per_page); ?>
|
||||||
件)</label>
|
件)</label>
|
||||||
</li>
|
</li>
|
||||||
<li><label>
|
<li><label>
|
||||||
@@ -27,10 +27,10 @@
|
|||||||
<li>
|
<li>
|
||||||
<label><input class="per_page_search" type="radio"
|
<label><input class="per_page_search" type="radio"
|
||||||
name="_apop_per_page[search]"
|
name="_apop_per_page[search]"
|
||||||
value=""<?php echo $per_page_data['_checked']; ?>>表示数設定
|
value="<?php echo esc_html($per_page_data['_checked']); ?>">表示数設定
|
||||||
<input class="per_page_search_input" type="text"
|
<input class="per_page_search_input" type="text"
|
||||||
name="_apop_per_page[search]"
|
name="_apop_per_page[search]"
|
||||||
value="<?php echo $per_page_data['_per_page_num']; ?>" required>
|
value="<?php echo esc_html($per_page_data['_per_page_num']); ?>" required>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -17,13 +17,13 @@
|
|||||||
<div class="select_cat">
|
<div class="select_cat">
|
||||||
<label>
|
<label>
|
||||||
<input type="hidden"
|
<input type="hidden"
|
||||||
name="<?php echo $order_name; ?>[target_cat][<?php echo $tax_datum->term_id; ?>]"
|
name="<?php echo esc_html($order_name); ?>[target_cat][<?php echo esc_html($tax_datum->term_id); ?>]"
|
||||||
value="0">
|
value="0">
|
||||||
<input class="select_cat_checkbox" type="checkbox"
|
<input class="select_cat_checkbox" type="checkbox"
|
||||||
name="<?php echo $order_name; ?>[target_cat][<?php echo $tax_datum->term_id; ?>]"
|
name="<?php echo esc_html($order_name); ?>[target_cat][<?php echo esc_html($tax_datum->term_id); ?>]"
|
||||||
<?php checked( $check_slug, 1 ); ?>
|
<?php checked( $check_slug, 1 ); ?>
|
||||||
value="1">
|
value="1">
|
||||||
<?php echo $tax_datum->name; ?>
|
<?php echo esc_html($tax_datum->name); ?>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<?php $per_page_data = APOP_UI::create_tax_per_page( $opt_per_page, $order_tax, $tax_datum->term_id ); ?>
|
<?php $per_page_data = APOP_UI::create_tax_per_page( $opt_per_page, $order_tax, $tax_datum->term_id ); ?>
|
||||||
@@ -32,27 +32,27 @@
|
|||||||
<li>
|
<li>
|
||||||
<label>
|
<label>
|
||||||
<input class="per_page_cat" type="radio"
|
<input class="per_page_cat" type="radio"
|
||||||
name="_apop_per_page[<?php echo $order_tax; ?>][<?php echo $tax_datum->term_id; ?>]"
|
name="_apop_per_page[<?php echo esc_html($order_tax); ?>][<?php echo esc_html($tax_datum->term_id); ?>]"
|
||||||
value="default"<?php checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う(<?php echo $default_per_page; ?>
|
value="default"<?php checked( $per_page_data['_per_page'], 'default' ); ?>>表示設定に従う(<?php echo esc_html($default_per_page); ?>
|
||||||
件)</label>
|
件)</label>
|
||||||
</li>
|
</li>
|
||||||
<li><label>
|
<li><label>
|
||||||
<input class="per_page_cat" type="radio"
|
<input class="per_page_cat" type="radio"
|
||||||
name="_apop_per_page[<?php echo $order_tax; ?>][<?php echo $tax_datum->term_id; ?>]"
|
name="_apop_per_page[<?php echo esc_html($order_tax); ?>][<?php echo esc_html($tax_datum->term_id); ?>]"
|
||||||
value="all"<?php checked( $per_page_data['_per_page'], 'all' ); ?>>全体設定に従う</label>
|
value="all"<?php checked( $per_page_data['_per_page'], 'all' ); ?>>全体設定に従う</label>
|
||||||
</li>
|
</li>
|
||||||
<li><label>
|
<li><label>
|
||||||
<input class="per_page_cat" type="radio"
|
<input class="per_page_cat" type="radio"
|
||||||
name="_apop_per_page[<?php echo $order_tax; ?>][<?php echo $tax_datum->term_id; ?>]"
|
name="_apop_per_page[<?php echo esc_html($order_tax); ?>][<?php echo esc_html($tax_datum->term_id); ?>]"
|
||||||
value="-1"<?php checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
|
value="-1"<?php checked( $per_page_data['_per_page'], '-1' ); ?>>全件</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="set_number_list">
|
<li class="set_number_list">
|
||||||
<label><input class="per_page_cat set_number" type="radio"
|
<label><input class="per_page_cat set_number" type="radio"
|
||||||
name="_apop_per_page[<?php echo $order_tax; ?>][<?php echo $tax_datum->term_id; ?>]"
|
name="_apop_per_page[<?php echo esc_html($order_tax); ?>][<?php echo esc_html($tax_datum->term_id); ?>]"
|
||||||
value=""<?php echo $per_page_data['_checked']; ?>>表示数設定
|
value=""<?php echo esc_html($per_page_data['_checked']); ?>>表示数設定
|
||||||
<input class="per_page_cat_input" type="text"
|
<input class="per_page_cat_input" type="text"
|
||||||
name="_apop_per_page[<?php echo $order_tax; ?>][<?php echo $tax_datum->term_id; ?>]"
|
name="_apop_per_page[<?php echo esc_html($order_tax); ?>][<?php echo esc_html($tax_datum->term_id); ?>]"
|
||||||
value="<?php echo $per_page_data['_per_page_num']; ?>" required>
|
value="<?php echo esc_html($per_page_data['_per_page_num']); ?>" required>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
<?php if ( isset( $this->order_field ) && count( $this->order_field ) > 0 ): ?>
|
<?php if ( isset( $this->order_field ) && count( $this->order_field ) > 0 ): ?>
|
||||||
<dl class="apop_setting_list_dd">
|
<dl class="apop_setting_list_dd">
|
||||||
<?php foreach ( $this->order_field as $type => $items ): ?>
|
<?php foreach ( $this->order_field as $type => $items ): ?>
|
||||||
<dt><?php echo $this->labels[ $type ]; ?></dt>
|
<dt><?php echo esc_html($this->labels[ $type ]); ?></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach ( $items as $item ): ?>
|
<?php foreach ( $items as $item ): ?>
|
||||||
<?php if ( ! empty( $item ) ): ?>
|
<?php if ( ! empty( $item ) ): ?>
|
||||||
<li><label><?php echo $item; ?></label>
|
<li><label><?php echo esc_html($item); ?></label>
|
||||||
<input type="text" name="<?php echo APOP_CUSTOM_FIELD_PREFIX . $item; ?>"
|
<input type="text" name="<?php echo APOP_CUSTOM_FIELD_PREFIX . $item; ?>"
|
||||||
value="<?php echo $this->get_custom_field_data( $item ); ?>"/>
|
value="<?php echo $this->get_custom_field_data( $item ); ?>"/>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
+26
-23
@@ -199,8 +199,32 @@ if ( ! trait_exists( 'APOP_ORDER_SETTING' ) ) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通常ページの1ページ表示件数を取得する
|
*
|
||||||
|
* 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()
|
* APOP::orderby_normal()
|
||||||
* @return array|null
|
* @return array|null
|
||||||
*/
|
*/
|
||||||
@@ -228,7 +252,7 @@ if ( ! trait_exists( 'APOP_ORDER_SETTING' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* カテゴリー、タグ、カスタム分類の1ページ表示件数を取得する
|
* カテゴリー、タグ、カスタム分類のソートを取得する
|
||||||
* APOP::orderby_tax([ID, TARGET], );
|
* APOP::orderby_tax([ID, TARGET], );
|
||||||
* [TARGET]
|
* [TARGET]
|
||||||
* cat
|
* cat
|
||||||
@@ -265,26 +289,5 @@ if ( ! trait_exists( 'APOP_ORDER_SETTING' ) ) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 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 ) );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user