Class AdminPageFramework_FieldType_taxonomy
A taxonomy field can list terms of specified taxonomies.
This class defines the taxonomy
field type.
Field Definition Arguments
Field Type Specific Arguments
- taxonomy_slugs - (optional, array) the taxonomy slug to
list. Default:
category
- max_width - (optional, string) the inline style property
value of
max-width
of this element. Include the unit such as px, %. Default: 100% - height - (optional, string) the inline style property value
of
height
of this element. Include the unit such as px, %. Default: 250px - select_all_button - [3.3.0+] (optional, array) pass
true
to enable theSelect All
button. To set a custom label, set the text such as__( 'Check All', 'test-domain' )
. Default:true
. - select_none_button - [3.3.0+] (optional, array) pass
true
to enable theSelect None
button. To set a custom label, set the text such as__( 'Check All', 'test-domain' )
. Default:true
. - label_no_term_found - [3.3.2+] (optional, string) The label
to display when no term is found. Default:
No Term Found
. - label_list_title - [3.3.2+] (optional, string) The heading
title string for a term list. Default:
''
. Insert an HTML custom string right before the list starts. - query - [3.3.2+] (optional, array) an query argument array
to search terms. For more details, see the argument of the [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters)
function.
- child_of - (integer) The parent term ID. All the descendant terms such as
child's child term will be listed. default:
0
- parent - (integer) The direct parent term ID. Only the first level children will be listed.
- orderby - (string) The type of how the term list should be ordered by.
Either
ID
,term_id
, orname
can be accepted. Default:name
. - order - (string) The order of the list.
ASC
orDESC
. Default:ASC
. - hide_empty - (boolean) whether to show the terms with no post associated.
Default:
false
. - hierarchical - (boolean) whether to show the terms as a hierarchical tree.
Default:
true
- number - (integer) The maximum number of the terms to show. 0 for no limit.
Default:
0
. - pad_counts - (boolean) whether to sum up the post counts with the child post
counts. Default:
false
- exclude - (string|array) Comma separated term IDs or an array to exclude
from the list. for example
1
will remove the 'Uncategorized' category from the list. - exclude_tree - (integer) For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters)..
- include - (string|array) Comma separated term IDs to include in the list.
- fields - (string) Default:
all
. For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters). - slug - (string) For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).
- get - (string) For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).
- name__like - (string) For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).
- description__like - (string) For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).
- offset - (integer) For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).
- search - (string) The search keyword to get the term with. Default
`.</li> <li>cache_domain - (string) Default:
core`. For more details see [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms#Parameters).
- child_of - (integer) The parent term ID. All the descendant terms such as
child's child term will be listed. default:
- queries - [3.3.2+] (optional, array) Sets a query argument for each taxonomy. The array key must be the taxonomy slug and the value is the query argument array.
- save_unchecked - [3.8.8+] (optional, boolean) Decides whether to save values of unchecked terms.
Common Field Definition Arguments
For common field definition arguments, seeAdminPageFramework_Factory_Controller::addSettingField()
.
Example
array( 'field_id' => 'taxonomy_checklist', 'title' => __( 'Taxonomy Checklist', 'admin-page-framework-loader' ), 'type' => 'taxonomy', 'height' => '200px', // (optional) 'width' => '400px', // (optional) 'show_post_count' => true, // (optional) whether to show the post count. Default: false. 'taxonomy_slugs' => array( 'category', 'post_tag', ), 'select_all_button' => false, // 3.3.0+ to change the label, set the label here 'select_none_button' => false, // 3.3.0+ to change the label, set the label here )
List Taxonomies with a Custom Query
array( 'field_id' => 'taxonomy_custom_queries', 'title' => __( 'Custom Taxonomy Queries', 'admin-page-framework-demo' ), 'type' => 'taxonomy', // (required) Determines which taxonomies should be listed 'taxonomy_slugs' => $aTaxnomies = get_taxonomies( '', 'names' ), // (optional) This defines the default query argument. For the structure and supported arguments, see http://codex.wordpress.org/Function_Reference/get_terms#Parameters 'query' => array( 'depth' => 2, 'orderby' => 'term_id', // accepts 'ID', 'term_id', or 'name' 'order' => 'DESC', // 'exclude' => '1', // removes the 'Uncategorized' category. // 'search' => 'PHP', // the search keyward // 'parent' => 9, // only show terms whose direct parent ID is 9. // 'child_of' => 8, // only show child terms of the term ID of 8. ), // (optional) This allows the user to set a query argument for each taxonomy. // Note that each element will be merged with the above default 'query' argument array. // So unset keys here will be overridden by the default argument array above. 'queries' => array( // taxonomy slug => query argument array 'category' => array( 'depth' => 2, 'orderby' => 'term_id', 'order' => 'DESC', 'exclude' => array( 1 ), ), 'post_tag' => array( 'orderby' => 'name', 'order' => 'ASC', // 'include' => array( 4, ), // term ids ), ), ),
Package: AdminPageFramework\Common\Form\FieldType
Since: 2.1.5
Since: 3.3.1 Changed to extend
Image: http://admin-page-framework.michaeluno.jp/image/common/form/field_type/taxonomy.png
Located at factory/_common/form/field_type/taxonomy/AdminPageFramework_FieldType_taxonomy.php
Since: 2.1.5
Since: 3.3.1 Changed to extend
AdminPageFramework_FieldType
from
AdminPageFramework_FieldType_Base
.Image: http://admin-page-framework.michaeluno.jp/image/common/form/field_type/taxonomy.png
Located at factory/_common/form/field_type/taxonomy/AdminPageFramework_FieldType_taxonomy.php
Methods summary
protected
array
|
#
getEnqueuingScripts( )
|
Magic methods summary
Properties summary
public
array
|
$aFieldTypeSlugs |
#
Defines the field type slugs used for this field type. |
protected
array
|
$aDefaultKeys |
#
Defines the default key-values of this field type. Remark$_aDefaultKeys holds shared default key-values defined in the base
class. |