PHP Class WPDKTerms

Author: =undo= ([email protected])
Datei anzeigen Open project: wpxtreme/wpdk

Public Properties

Property Type Description
$cache_domain string In WordPress Version 3.2 and above. The 'cache_domain' argument enables a unique cache key to be produced when the query produced by get_terms() is stored in object cache. For instance, if you are using one of this function's filters to modify the query (such as 'terms_clauses'), setting 'cache_domain' to a unique value will not overwrite the cache for similar queries. Default value is 'core'.
$child_of integer Get all descendents of this term. Default is 0.
$exclude integer | string | array An array of term ids to exclude. Also accepts a string of comma-separated ids.
$exclude_tree array An array of parent term ids to exclude
$fields string all - returns an array of term objects - Default ids - returns an array of integers names - returns an array of strings count - (3.2+) returns the number of terms found id=>parent - returns an associative array where the key is the term id and the value is the parent term id if present or 0
$get string Allow for overwriting 'hide_empty' and 'child_of', which can be done by setting the value to 'all'.
$hide_empty boolean true - Default (i.e. Do not show empty terms) false
$hierarchical boolean 1 (true) - Default 0 (false)
$include array An array of term ids to include. Empty returns all.
$name__like string This matches terms that begin with the 'name__like' string.
$number integer The maximum number of terms to return. Default is to return them all.
$offset integer The number by which to offset the terms query.
$order string ASC - Default DESC
$orderby string id count name - Default slug term_group - Not fully implemented (avoid using) none
$pad_counts boolean 1 (true) 0 (false) - Default
$parent integer Get direct children of this term (only terms whose explicit parent is this value). If 0 is passed, only top-level terms are returned. Default is an empty string.
$search string This matches terms that contain the 'search' string.
$slug string Returns terms whose "slug" matches this value. Default is empty string.

Public Methods

Method Description
__construct ( string | array $taxonomy = 'category' ) : WPDKTerms Create an instance of WPDKTerms class
breadCrumbs ( integer | object | string $term ) : array Return the array of term from parent
term ( integer | object | string $term ) : WP_Error | WPDKTerm Return a single term by id, object, name or slug
terms ( ) : array | WP_Error Return an array of term objects
tree ( boolean $child_of = false ) : array | WP_Error Return a tree list of terms. Used to build an indent list of children

Method Details

__construct() public method

Create an instance of WPDKTerms class
public __construct ( string | array $taxonomy = 'category' ) : WPDKTerms
$taxonomy string | array Optional. Single or array of taxonomy ID. Default 'category'
return WPDKTerms

breadCrumbs() public method

Return the array of term from parent
public breadCrumbs ( integer | object | string $term ) : array
$term integer | object | string If integer, will get from database. If object will apply filters and return $term. If string started with `%` will get by `get_term_by( 'name' )` Else if string will get by `get_term_by( 'slug' )`
return array

term() public method

Return a single term by id, object, name or slug
public term ( integer | object | string $term ) : WP_Error | WPDKTerm
$term integer | object | string If integer, will get from database. If object will apply filters and return $term. If string started with `%` will get by `get_term_by( 'name' )` Else if string will get by `get_term_by( 'slug' )`
return WP_Error | WPDKTerm

terms() public method

Return an array of term objects
public terms ( ) : array | WP_Error
return array | WP_Error

tree() public method

Return a tree list of terms. Used to build an indent list of children
public tree ( boolean $child_of = false ) : array | WP_Error
$child_of boolean Optional. Default false
return array | WP_Error

Property Details

$cache_domain public_oe property

In WordPress Version 3.2 and above. The 'cache_domain' argument enables a unique cache key to be produced when the query produced by get_terms() is stored in object cache. For instance, if you are using one of this function's filters to modify the query (such as 'terms_clauses'), setting 'cache_domain' to a unique value will not overwrite the cache for similar queries. Default value is 'core'.
public string $cache_domain
return string

$child_of public_oe property

Get all descendents of this term. Default is 0.
public int $child_of
return integer

$exclude public_oe property

An array of term ids to exclude. Also accepts a string of comma-separated ids.
public int|string|array $exclude
return integer | string | array

$exclude_tree public_oe property

An array of parent term ids to exclude
public array $exclude_tree
return array

$fields public_oe property

all - returns an array of term objects - Default ids - returns an array of integers names - returns an array of strings count - (3.2+) returns the number of terms found id=>parent - returns an associative array where the key is the term id and the value is the parent term id if present or 0
public string $fields
return string

$get public_oe property

Allow for overwriting 'hide_empty' and 'child_of', which can be done by setting the value to 'all'.
public string $get
return string

$hide_empty public_oe property

true - Default (i.e. Do not show empty terms) false
public bool $hide_empty
return boolean

$hierarchical public_oe property

1 (true) - Default 0 (false)
public bool $hierarchical
return boolean

$include public_oe property

An array of term ids to include. Empty returns all.
public array $include
return array

$name__like public_oe property

This matches terms that begin with the 'name__like' string.
public string $name__like
return string

$number public_oe property

The maximum number of terms to return. Default is to return them all.
public int $number
return integer

$offset public_oe property

The number by which to offset the terms query.
public int $offset
return integer

$order public_oe property

ASC - Default DESC
public string $order
return string

$orderby public_oe property

id count name - Default slug term_group - Not fully implemented (avoid using) none
public string $orderby
return string

$pad_counts public_oe property

1 (true) 0 (false) - Default
public bool $pad_counts
return boolean

$parent public_oe property

Get direct children of this term (only terms whose explicit parent is this value). If 0 is passed, only top-level terms are returned. Default is an empty string.
public int $parent
return integer

$slug public_oe property

Returns terms whose "slug" matches this value. Default is empty string.
public string $slug
return string