Top_Ten_Core_Query
Query API: Top_Ten_Core_Query class.
Namespace: WebberZone\Top_Ten
Since: 4.0.0
Source: includes/class-top-ten-core-query.php line 25
Extends: WP_Query
Methods
__construct()
Main constructor.
Since: 3.0.0
Line: 122
public function __construct( $args = ... );
| Type | Name | Description |
|---|---|---|
array|string | $args | The Query variables. Accepts an array or a query string. |
hooks()
Set up hooks.
Since: 4.0.0
Line: 135
public function hooks( );
prepare_query_args()
Prepare the query variables.
Since: 3.0.0
Line: 168
public function prepare_query_args( $args = ... );
| Type | Name | Description |
|---|---|---|
string|array | $args | { |
pre_get_posts()
Modify the pre_get_posts clause.
Since: 4.0.0
Line: 464
public function pre_get_posts( $query );
| Type | Name | Description |
|---|---|---|
\WP_Query | $query | The WP_Query instance. |
posts_fields()
Modify the SELECT clause - posts_fields.
Since: 3.0.0
Line: 501
public function posts_fields( $fields, $query ): string;
| Type | Name | Description |
|---|---|---|
string | $fields | The SELECT clause of the query. |
\WP_Query | $query | The \WP_Query instance. |
Returns: string — Updated Fields
posts_join()
Modify the posts_join clause.
Since: 3.0.0
Line: 539
public function posts_join( $join, $query ): string;
| Type | Name | Description |
|---|---|---|
string | $join | The JOIN clause of the query. |
\WP_Query | $query | The \WP_Query instance. |
Returns: string — Updated JOIN
posts_where()
Modify the posts_where clause.
Since: 3.0.0
Line: 573
public function posts_where( $where, $query ): string;
| Type | Name | Description |
|---|---|---|
string | $where | The WHERE clause of the query. |
\WP_Query | $query | The \WP_Query instance. |
Returns: string — Updated WHERE
posts_orderby()
Modify the ORDER BY clause of the query.
Since: 3.0.0
Line: 623
public function posts_orderby( $orderby, $query ): string;
| Type | Name | Description |
|---|---|---|
string | $orderby | The current ORDER BY clause. |
\WP_Query | $query | The current query instance. |
Returns: string — Modified ORDER BY clause.
posts_groupby()
Modify the posts_groupby clause.
Since: 3.0.0
Line: 665
public function posts_groupby( $groupby, $query ): string;
| Type | Name | Description |
|---|---|---|
string | $groupby | The GROUP BY clause of the query. |
\WP_Query | $query | The \WP_Query instance. |
Returns: string — Updated GROUP BY
posts_clauses()
Modify posts_clauses in WP_Query to handle multiple blogs.
Since: 3.2.0
Line: 700
public function posts_clauses( $clauses, $query ): array;
| Type | Name | Description |
|---|---|---|
array | $clauses | Query clauses. |
\WP_Query | $query | The \WP_Query instance. |
Returns: array — Updated Query Clauses.
posts_request()
Modify the completed SQL query before sending.
Since: 3.2.0
Line: 765
public function posts_request( $sql, $query ): string;
| Type | Name | Description |
|---|---|---|
string | $sql | The complete SQL query. |
\WP_Query | $query | The \WP_Query instance (passed by reference). |
Returns: string — Updated SQL.
switch_to_blog_in_loop()
Update the_post while \WP_Query loops through this.
Since: 3.2.0
Line: 805
public function switch_to_blog_in_loop( $post );
| Type | Name | Description |
|---|---|---|
\WP_Post | $post | The Post object (passed by reference). |
loop_end()
Restore current blog on loop end.
Since: 3.2.0
Line: 821
public function loop_end( );
posts_pre_query()
Filter posts_pre_query to allow caching to work.
Since: 3.0.0
Line: 836
public function posts_pre_query( $posts, $query ): \WP_Post[];
| Type | Name | Description |
|---|---|---|
\WP_Post[] | $posts | Array of post objects. |
\WP_Query | $query | The WP_Query instance (passed by reference). |
Returns: \WP_Post[] — Updated Array of post objects.
the_posts()
Modify the array of retrieved posts.
Since: 3.0.0
Line: 891
public function the_posts( $posts, $query ): \WP_Post[];
| Type | Name | Description |
|---|---|---|
\WP_Post[] | $posts | Array of post objects. |
\WP_Query | $query | The \WP_Query instance (passed by reference). |
Returns: \WP_Post[] — Updated Array of post objects.