I coded a class that stores metadata for taxonomy terms in the options table and working with it is fairly simple ex:
//include the main class file
require_once("Tax-meta-class/Tax-meta-class.php");
// configure taxonomy custom fields
$config = array(
'id' => 'demo_tax_meta_box', // meta box id, unique per meta box
'title' => 'Demo Meta Box', // meta box title
'pages' => array('menus'), // taxonomy name, accept categories, post_tag and custom taxonomies
'context' => 'normal', // where the meta box appear: normal (default), advanced, side; optional
'fields' => array(), // list of meta fields (can be added by field arrays)
'local_images' => false, // Use local or hosted images (meta box images for add/remove)
'use_with_theme' => false //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
);
// Initiate your taxonomy custom fields
$my_meta = new Tax_Meta_Class($config);
// Add fields
//text field
$my_meta->addText('text_field_id',array('name'=> 'My tax Text '));
//textarea field
$my_meta->addTextarea('textarea_field_id',array('name'=> 'My tax Textarea '));
//Image field
$my_meta->addImage('image_field_id',array('name'=> 'My tax Image '));
//Finish Taxonomy Extra fields Deceleration
$my_meta->Finish();
this will add a text field, textarea field and an image field.
And getting the stored data is also very simple:
$saved_data = get_tax_meta($term_id,'text_field_id');
echo $saved_data;
currently the class supports:
- Input
- Textarea
- Radio button
- Checkbox
- Select Dropdown
- File Upload
- Image Upload
- WYSIWYG editor
- Date Picker
- Time Picker
- Color Picker
- Taxonomy List Dropdwon
- Post list Dropdown
- Repeater Field
to read more about it look at : WordPress taxonomies extra fields the easy way