Tkt_Search_And_Filter_Posts_Query

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
author

Beda Schmid beda@tukutoi.com

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

Methods

__construct()

Initialize the class and set its properties.

public __construct(object $sanitizer) : mixed
Parameters
$sanitizer
(object) The sanitizer object.
Tags
since
1.0.0
Return
(mixed)

get_query_results()

Get the Query results.

public get_query_results() : array<string|int, mixed>
Tags
since
1.0.0
Return
(array<string|int, mixed>) $this->query_results The Query Results.

set_custom_pagarg()

Set the custom Pagination arg.

public set_custom_pagarg(string $pagarg) : void
Parameters
$pagarg
(string) The Custom pagination argument.
Tags
since
1.0.0
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
since
2.0.0
access

private

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
since
1.0.0
access

public

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
since
2.11.0
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
since
2.19.0
Return
(mixed)

get_query_args()

Get the Query Args

private get_query_args() : array<string|int, mixed>
Tags
since
1.0.0
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.
Tags
since
1.0.0
Return
(void)

Search results