justintadlock / butterbean

A neat little post meta framework.
GNU General Public License v2.0
204 stars 31 forks source link

New control: taxonomy #28

Open slaFFik opened 7 years ago

slaFFik commented 7 years ago

Give ability to display a select box of registered taxonomies, that are associated with the current CPT.

Use case: registered custom taxonomy, but made a hidden UI to select terms for this CPT. Each section in ButterBean (like, repeatable data) should have own term or particular (the same or different) taxonomy. Handy for galleries etc.

Possible code:

$manager->register_control(
    'bbe_taxonomy_a',
    array(
        'type'        => 'taxonomy',
        'section'     => 'section_name',
        'taxonomy'    => 'some_taxonomy',
        'label'       => __( 'Related Taxonomy', 'ilm' ),
        'description' => __( 'Some Description', 'text-domain' )
    )
);

Display in a dropdown all terms under some_taxonomy taxonomy.