wpscholar / wp-taxonomy-radio-group
A WordPress walker class and function for rendering a taxonomy radio group.
Installs: 3 566
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 1
Open Issues: 0
This package is auto-updated.
Last update: 2024-10-29 05:10:24 UTC
README
A WordPress walker class and function for rendering a taxonomy radio group.
Getting Started
The anticipated use case for this is removing the normal hierarchical taxonomy metabox from the WordPress admin and replacing with a custom metabox with radio buttons (as opposed to the normal checkboxes).
For example, here is how to replace the standard categories metabox on the post edit screen with our own custom one:
<?php add_action( 'admin_menu', function () { $taxonomy = get_taxonomy( 'category' ); add_meta_box( "{$taxonomy->name}div", $taxonomy->label, function () use ( $taxonomy ) { echo wp_tax_radio_group( $taxonomy->name ); }, 'post', 'side' ); } );