Tkt_Search_And_Filter_Posts_Query
in package
The Posts Query Builder
Description
Defines all available arguments of the WP_Query Populates those arguments according user settings Gets results from the WP_Query Builds the output and loads accurate templates
Tags
Table of Contents
- $instance : string
- The Search and Results Instance
- $query_args : array<string|int, mixed>
- The WP_Query arguments
- $query_results : array<string|int, mixed>
- The Query Results
- $type : string
- The Type of query
- __construct() : mixed
- Initialize the class and set its properties.
- get_query_results() : array<string|int, mixed>
- Get the Query results.
- get_type() : mixed
- Get the type of Query request.
- set_custom_pagarg() : void
- Set the custom Pagination arg.
- set_instance() : mixed
- Set The Unique Instance.
- set_query_args() : mixed
- Set the Query Args
- set_type() : mixed
- Set the type of Query request.
- the_loop() : mixed
- The Query Results (non ajax)
- tkt_ajax_loop() : mixed
- Build the Loop Results in AJAX request.
- tkt_ajax_query() : mixed
- The Query Results (ajax)
- get_query_args() : array<string|int, mixed>
- Get the Query Args
- set_posts_per_page() : void
- Set the custom posts per page arg.
Properties
$instance
The Search and Results Instance
private
string
$instance
Description
Unique instance to bind Search and Results.
Tags
$query_args
The WP_Query arguments
private
array<string|int, mixed>
$query_args
Description
All Possible Arguments of the WP_Query.
Tags
$query_results
The Query Results
private
array<string|int, mixed>
$query_results
Description
The Results of the WP_Query.
Tags
$type
The Type of query
private
string
$type
Description
The Type of query - AJAX or Reload.
Tags
Methods
__construct()
Initialize the class and set its properties.
public
__construct(object $sanitizer) : mixed
Parameters
- $sanitizer
- (object) The sanitizer object.
Tags
Return
(mixed)get_query_results()
Get the Query results.
public
get_query_results() : array<string|int, mixed>
Tags
Return
(array<string|int, mixed>) $this->query_results The Query Results.get_type()
Get the type of Query request.
public
get_type() : mixed
Description
Only used to enqueue scripts conditionally.
Tags
Return
(mixed)set_custom_pagarg()
Set the custom Pagination arg.
public
set_custom_pagarg(string $pagarg) : void
Parameters
- $pagarg
- (string) The Custom pagination argument.
Tags
Return
(void)set_instance()
Set The Unique Instance.
public
set_instance(string $instance) : mixed
Parameters
- $instance
- (string) The Unique instance of Search and Loop to "connect" them.
Tags
Return
(mixed)set_query_args()
Set the Query Args
public
set_query_args(array<string|int, mixed> $default_query_args) : mixed
Parameters
- $default_query_args
- (array<string|int, mixed>) Default Query args passed to the Loop Renderer.
Tags
Return
(mixed)set_type()
Set the type of Query request.
public
set_type(string $type) : mixed
Description
Only used to enqueue scripts conditionally.
Parameters
- $type
- (string) ajax|''.
Tags
Return
(mixed)the_loop()
The Query Results (non ajax)
public
the_loop(mixed $content, mixed $error) : mixed
Parameters
- $content
- (mixed) The ShortCode enclosing content.
- $error
- (mixed) The ShortCode error/nothing found provided by user.
Return
(mixed)tkt_ajax_loop()
Build the Loop Results in AJAX request.
public
tkt_ajax_loop() : mixed
Description
We use a POST request because we need to resolve the template. The Template might hold ShortCodes (nested/attributes) and even be encoded. Thus we cannot use a GET request because the Request URI might become too long very quickly.
Tags
Return
(mixed)tkt_ajax_query()
The Query Results (ajax)
public
tkt_ajax_query() : mixed
Return
(mixed)get_query_args()
Get the Query Args
private
get_query_args() : array<string|int, mixed>
Tags
Return
(array<string|int, mixed>) $this->query_args The merged query args.set_posts_per_page()
Set the custom posts per page arg.
private
set_posts_per_page(string $posts_per_page) : void
Parameters
- $posts_per_page
- (string) The Custom posts per page argument.