1 | <?php |
||
13 | class Query_Helper { |
||
14 | |||
15 | /** |
||
16 | * Finds or creates new query based on provided params. |
||
17 | * |
||
18 | * @param array|boolean $args Args for WP_Query. |
||
19 | * |
||
20 | * @return \WP_Query |
||
21 | */ |
||
22 | public static function find_query( $args = false ) { |
||
35 | |||
36 | /** |
||
37 | * Returns current WP_Query. |
||
38 | * |
||
39 | * @return \WP_Query |
||
40 | */ |
||
41 | public static function get_current_query() { |
||
48 | |||
49 | /** |
||
50 | * Checks and returns WP_Query for home posts page. |
||
51 | * |
||
52 | * @param \WP_Query $query WP_Query object. |
||
53 | * |
||
54 | * @return \WP_Query |
||
55 | */ |
||
56 | private static function handle_maybe_custom_posts_page( $query ) { |
||
68 | } |
||
69 |
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state