pfeifferNet

Term_Archive
in package

Term archive functionality.

Tags
since
6.0.0

Table of Contents

Constants

ACTION  = 'filter_archive'
The wp_ajax hook action property for the ajax archive filter.
DEFAULT_ARCHIVE_ARGS  = array('archive_tax' => '', 'archive_term' => '', 'filter_tax' => '', 'filter_term' => '', 'object_type' => 'any', 'page_num' => 1, 'post_status' => 'publish')
The default archive filter arguments.
FILTER_CONTAINER  = 'form-archive-filter.php'
The archive filter container partial.
NAVIGATION_CONTAINER  = 'archive-navigation.php'
The navigation container partial
NONCE_NAME  = 'token'
The archive filter form nonce name.

Properties

$filter_container  : string
The fully qualified path to the archive filter partial.
$instances  : array<string|int, object>
The array of instances of this class and sub-classes.
$navigation_container  : string
The fully qualified path to the archive filter navigation partial.
$progress_container  : string
The progress indicator container markup.

Methods

get_action()  : string
Return the action name.
get_instance()  : object
Creates and/or returns the instance of this class.
handle_filter_request()  : void
Handle ajax archive filter request.
render_filter()  : void
Show a filter drop-down list on archive pages.
__construct()  : void
Initialise the class.
enqueue_assets()  : void
Enqueue the archive filter script and styles.
get_content()  : array<string|int, mixed>
Return the markup and metadata for the filtered archive content.
get_inline_script()  : string
Get the inline javascript.
get_navigation()  : string
Return the markup for the filtered archive navigation block.
get_query_arguments()  : array<string|int, mixed>
Return the WP_Query arguments based on archive and filter parameters.

Constants

ACTION

The wp_ajax hook action property for the ajax archive filter.

protected string ACTION = 'filter_archive'
Tags
since
6.4.0

DEFAULT_ARCHIVE_ARGS

The default archive filter arguments.

protected array<string|int, mixed> DEFAULT_ARCHIVE_ARGS = array('archive_tax' => '', 'archive_term' => '', 'filter_tax' => '', 'filter_term' => '', 'object_type' => 'any', 'page_num' => 1, 'post_status' => 'publish')
  • The 'archive' variables define the archive being filtered.
  • The 'filter' variables define the filter being applied.

{ The array of aruments to select posts for the archive. @type string $archive_tax The taxonomy to use for the archive. @type int $archive_term The term ID to use for the archive. @type string $filter_tax The taxonomy to use for the filter. @type int $filter_term The term ID to use for the filter. @type string $object_type Optional. The object type to select. Defaults to 'post' @type int $page_num Optional. The WP_Query page number. Defaults to 1. @type string $post_status Optional. The post status to select. Defaults to 'publish'. }

Tags
since
6.0.0

FILTER_CONTAINER

The archive filter container partial.

protected string FILTER_CONTAINER = 'form-archive-filter.php'
Tags
since
6.0.0

NAVIGATION_CONTAINER

The navigation container partial

protected string NAVIGATION_CONTAINER = 'archive-navigation.php'
  • Used if there is paginated output for the filtered archive.
Tags
since
6.4.0

NONCE_NAME

The archive filter form nonce name.

protected string NONCE_NAME = 'token'
Tags
since
6.4.0

Properties

$filter_container

The fully qualified path to the archive filter partial.

protected string $filter_container = ''
Tags
since
6.0.0

$instances

The array of instances of this class and sub-classes.

protected static array<string|int, object> $instances = array()
Tags
since
6.0.0

$navigation_container

The fully qualified path to the archive filter navigation partial.

protected string $navigation_container = ''
Tags
since
6.4.0

$progress_container

The progress indicator container markup.

protected string $progress_container = ''
Tags
since
6.0.0

Methods

get_action()

Return the action name.

public get_action() : string
Tags
since
6.4.0
Return values
string

The action name.

get_instance()

Creates and/or returns the instance of this class.

public static get_instance() : object
Tags
since
6.0.0
Return values
object

The instance of this class.

render_filter()

Show a filter drop-down list on archive pages.

public render_filter(WP_Term $archive_term, string $filter_taxonomy) : void
Parameters
$archive_term : WP_Term

The archive taxonomy term.

$filter_taxonomy : string

The taxonomy to use as the filter.

Tags
since
6.0.0
used-by
add_course_filter()

enqueue_assets()

Enqueue the archive filter script and styles.

protected enqueue_assets() : void
Tags
since
6.4.0

get_content()

Return the markup and metadata for the filtered archive content.

protected get_content(array<string|int, mixed> $archive_args) : array<string|int, mixed>
  • Includes content markup, current WP_Query page number and total number of pages.
Parameters
$archive_args : array<string|int, mixed>

The array of arguments to select posts for the archive.

Tags
since
6.4.0
uses
Grid::get_card()
uses
Messages::get_message()
see
Term_Archive::DEFAULT_ARCHIVE_ARGS
Return values
array<string|int, mixed>

{ The content markup and metadata. @type string $markup The filtered archive content markup. @type int $page_num The number of the current query page. @type int $num_pages The maximum number of pages in the WP_Query object. }

get_inline_script()

Get the inline javascript.

protected get_inline_script() : string
Tags
since
6.4.0
Return values
string

The inline script.

get_navigation()

Return the markup for the filtered archive navigation block.

protected get_navigation(int $page_num, int $num_pages) : string
  • This replaces the normal pagination when filters are applied.
Parameters
$page_num : int

The current query page number.

$num_pages : int

The maximum number of pages in the WP_Query object.

Tags
since
6.4.0
Return values
string

The navigation block markup.

get_query_arguments()

Return the WP_Query arguments based on archive and filter parameters.

protected get_query_arguments(array<string|int, mixed> $archive_args) : array<string|int, mixed>
Parameters
$archive_args : array<string|int, mixed>

The array of arguments to select posts for the archive.

Tags
since
6.0.0
see
Term_Archive::DEFAULT_ARCHIVE_ARGS
Return values
array<string|int, mixed>

The WP_Query args.


        
On this page

Search results