PHP Class WPDKTerm

## Overview This class introducing a lot of feature for term management. $term = WPDKTerm::term( '%colors' ); // get by name $term = WPDKTerm::term( 'colors-house' ); // get by slug $term = WPDKTerm::term( 116 ); // get by id $term = WPDKTerm::term( 116, 'custom-tax' ); // get by id witha custom taxonomy $ancestor = WPDKTerm::ancestor( $term ); // get the ancestor (top parent)
Author: =undo= ([email protected])
Show file Open project: wpxtreme/wpdk Class Usage Examples

Public Properties

Property Type Description
$count
$description
$name
$parent
$parent_term
$permalink
$slug
$taxonomy
$term_group
$term_id
$term_taxonomy_id

Public Methods

Method Description
ancestor ( ) : boolean | WPDKTerm Return the ancestor (top parent) WPDKTerm object. If FALSE no ancestor object found.
ancestorOfTerm ( WPDKterm $term ) : boolean | WPDKTerm Return the ancestor (top parent) WPDKTerm object. If FALSE no ancestor object found.
term ( integer | object | string $term, string $taxonomy = false, string $output = OBJECT, string $filter = 'raw', boolean $parent = false ) : WPDKTerm | WP_Error Return an instance of WPDKTerm class as extended-map of WordPress term.

Private Methods

Method Description
__construct ( object $term ) : WPDKTerm Create an instance of WPDKTerm class

Method Details

ancestor() public method

Return the ancestor (top parent) WPDKTerm object. If FALSE no ancestor object found.
public ancestor ( ) : boolean | WPDKTerm
return boolean | WPDKTerm

ancestorOfTerm() public static method

Return the ancestor (top parent) WPDKTerm object. If FALSE no ancestor object found.
public static ancestorOfTerm ( WPDKterm $term ) : boolean | WPDKTerm
$term WPDKterm An instance of WPDKTerm class
return boolean | WPDKTerm

term() public static method

Return an instance of WPDKTerm class as extended-map of WordPress term.
public static term ( integer | object | string $term, string $taxonomy = false, string $output = OBJECT, string $filter = 'raw', boolean $parent = false ) : WPDKTerm | WP_Error
$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' )`
$taxonomy string Optipnal. Taxonomy name that $term is part of. If FASLE retrive the term info
$output string Optional. Constant OBJECT, ARRAY_A, or ARRAY_N
$filter string Optional. Default is raw or no WordPress defined filter will applied.
$parent boolean Optional. If TRUE an object WPDKTerm is create in parent_term property
return WPDKTerm | WP_Error Term Row from database. Will return null if $term is empty. If taxonomy does not exist then WP_Error will be returned.

Property Details

$count public property

public $count

$description public property

public $description

$name public property

public $name

$parent public property

public $parent

$parent_term public property

public $parent_term

$slug public property

public $slug

$taxonomy public property

public $taxonomy

$term_group public property

public $term_group

$term_id public property

public $term_id

$term_taxonomy_id public property

public $term_taxonomy_id