pfeifferNet

Term_Grid
in package

Taxonomy terms grid functionality.

Provdes a grid of taxonomy terms, linked to their archive page.

Tags
since
5.9.0
since
5.11.0

Deprecated global singleton.

since
6.0.0

Refactor to use new grid handler.

Table of Contents

Constants

CARD_DEFAULTS  = array('card_level' => 2, 'description' => '', 'image_id' => 0, 'itemprop' => '', 'itemtype' => '', 'metadata' => array(), 'name' => '', 'new_tab' => false, 'url' => '')
The default grid card display attributes.
CONTAINER_DEFAULTS  = array('itemprop' => '', 'itemtype' => '', 'metadata' => array())
The default grid container display attributes.
TAX_EXCERPT_KEY  = 'pnet_excerpt'
Define taxonomy term excerpt key name.
TAX_IMAGE_KEY  = 'pnet_image_id'
Define taxonomy term image key name.
TV_DEFAULTS  = array('childless' => false, 'hide_empty' => true, 'order' => 'ASC', 'orderby' => 'name', 'parent' => '', 'taxonomy' => '')
The default term selection query variables.

Properties

$grid  : Grid
The instance of the Grid class.
$instances  : array<string|int, object>
The array of instances of this class and sub-classes.
$media  : Media
The instance of the Media class.
$taxonomy  : Taxonomy
The instance of the Taxonomy class.
$term  : Term
The instance of the Term class.

Methods

get_instance()  : object
Creates and/or returns the instance of this class.
render()  : void
Render the taxonomy terms grid.
__construct()  : void
Initialise the class and set its properties.
get_cards()  : string
Return cards markup for each term in the selected taxonomy.
get_terms()  : array<string|int, WP_Term>
Get the array of terms.

Constants

CARD_DEFAULTS

The default grid card display attributes.

protected array<string|int, mixed> CARD_DEFAULTS = array('card_level' => 2, 'description' => '', 'image_id' => 0, 'itemprop' => '', 'itemtype' => '', 'metadata' => array(), 'name' => '', 'new_tab' => false, 'url' => '')

CARD_DEFAULTS { Default values for grid card. @type int $card_level Heading level to apply to card name (defaults to paragraph if not set). @type string $description Short description of the member. @type int $image_id The attachment ID of the image. @type string $itemprop Schema.org itemprop value for the card. @type string $itemtype URL of schema.org itemtype definition. @type array $metadata Array of itemprop key/value pairs for the card @type string $name Name of member. Used for title. @type bool $new_tab Open URL in new tab flag. @type string $url The URL the card points to. }

Tags
since
5.9.0
since
6.0.0

Refactor for new grid functionality.

CONTAINER_DEFAULTS

The default grid container display attributes.

protected array<string|int, mixed> CONTAINER_DEFAULTS = array('itemprop' => '', 'itemtype' => '', 'metadata' => array())

CONTAINER_DEFAULTS { Default values for card grid container. @type string $itemprop Schema.org itemprop value for the container. @type string $itemtype URL of schema.org itemtype definition. @type array $metatdata Array of itemprop key/value pairs for the container. }

Tags
since
5.9.0
since
6.0.0

Refactor for new grid functionality.

see
Grid::CONTAINER_DEFAULTS

TAX_EXCERPT_KEY

Define taxonomy term excerpt key name.

protected string TAX_EXCERPT_KEY = 'pnet_excerpt'
Tags
since
5.9.0

TAX_IMAGE_KEY

Define taxonomy term image key name.

protected string TAX_IMAGE_KEY = 'pnet_image_id'
Tags
since
5.9.0

TV_DEFAULTS

The default term selection query variables.

protected array<string|int, mixed> TV_DEFAULTS = array('childless' => false, 'hide_empty' => true, 'order' => 'ASC', 'orderby' => 'name', 'parent' => '', 'taxonomy' => '')

TV_DEFAULTS{ Default term query variables. @type bool $childless Limit results to terms that have no children. @type bool $hide_empty Hide terms not assigned to any posts @type string $order Sort order. @type string $orderby The property to order by. @type string $parent The slug of the parent taxonomy term. @type string $taxonomy The name of the taxonomy to use. }

Tags
since
6.0.0

Properties

$instances

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

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

Methods

get_instance()

Creates and/or returns the instance of this class.

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

The instance of this class.

render()

Render the taxonomy terms grid.

public render([array<string|int, mixed> $args = array() ]) : void

This renders a grid of cards showing terms in the selected taxonomy.

Parameters
$args : array<string|int, mixed> = array()

The taxonomy grid selection arguments.

Tags
since
5.9.0
uses
Grid::render()
used-by
Term_Grid::the_content()

get_cards()

Return cards markup for each term in the selected taxonomy.

protected get_cards([array<string|int, mixed> $args = array() ]) : string
Parameters
$args : array<string|int, mixed> = array()

The incoming arguments to render() method.

Tags
since
5.9.0
since
6.0.0

Refactor for new grid functionality.

uses
Media::get_fallback_image_id()
uses
Grid::get_card()
Return values
string

The taxonomy term cards markup.

get_terms()

Get the array of terms.

protected get_terms(array<string|int, mixed> $args) : array<string|int, WP_Term>
Parameters
$args : array<string|int, mixed>

The term selection arguments.

Tags
since
6.0.0
uses
Taxonomy::get_terms()
see
Taxonomy::TV_DEFAULTS
Return values
array<string|int, WP_Term>

An array of (maybe filtered) sorted WP_Term objects or an empty array on failure.


        
On this page

Search results