searchwp\query\per_page
4.0.0以降
1ページあたりの結果数をカスタマイズします。
パラメータ
| タイプ | パラメータ | デフォルト | 提供開始 |
|---|---|---|---|
| 整数 | $per_page |
get_option( 'posts_per_page' ) |
4.0.0 |
| 配列 | $args |
クエリ引数 | 4.0.0 |
例
All hooks should be added to your custom SearchWP Customizations Plugin.
1ページあたり12件の結果を返す
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Return 12 results per page of SearchWP results. | |
| add_filter( 'searchwp\query\per_page', function( $per_page, $args ) { | |
| return 12; | |
| }, 30, 2 ); |

