Created
September 14, 2012 18:35
-
-
Save alexkingorg/3723819 to your computer and use it in GitHub Desktop.
Treat WordPress custom taxonomy as meta data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// check for a term and insert it if it doesn't exist | |
if (!get_term_by('slug', $term_slug, $taxonomy)) { | |
wp_insert_term(__($term_name, 'localization-key'), $taxonomy, array( | |
'slug' => $term_slug | |
)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// remove all functionality from hierarchical taxonomy UI box (other than term selection) | |
// *and* convert the checkboxes to radio buttons to enforce single selection (this is untested) | |
$('#taxonomy-' + yourTaxonomyName) | |
.find('.category-tabs, div:not(".tabs-panel")').remove().end() | |
.find('.tabs-panel').removeClass('tabs-panel').end() | |
.find('input[type="checkbox"]').attr('type', 'radio'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// remove all functionality from hierarchical taxonomy UI box (other than term selection) | |
$('#taxonomy-' + yourTaxonomyName) | |
.find('.category-tabs, div:not(".tabs-panel")').remove().end() | |
.find('.tabs-panel').removeClass('tabs-panel'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment