This repository was archived by the owner on Jun 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Taxonomy
Aleksandr Strikha edited this page Oct 8, 2015
·
2 revisions
namespace: WPKit\Taxonomy
Wrapper class for register_taxonomy.
Register and configure a taxonomy.
string $slug - unique key;
string $singular_name - taxonomy title (singular);
array $labels (optional) - array of taxonomy labels;
Example:
$brand_taxonomy = new Taxonomy( 'brand', __( 'Brand' ) ); This example creates a taxonomy named "Brand".
Attach Post Type to taxonomy.
Add [TaxonomyField] to taxonomy.
Example:
$brand_taxonomy->add_custom_field( 'logo', __('Logo'), 'Image' );
// get the filed value
$value = Taxonomy::get_custom_field_value( $term_id, 'logo' );
// equivalent
$brand_logo = new TaxonomyField( 'brand', 'logo', __('Logo'), 'Image' );
$value = TaxonomyField::get( $term_id, 'logo' ); Set automatic pluralization.
Default: true
Данный метод указывает будет ли отображаться таксономия в таблице листига post type.
Default: true