forked from scribu/wp-front-end-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Editing taxonomies
scribu edited this page May 8, 2011
·
4 revisions
There isn't anything special you need to do to make post tags and categories editable. It should just work.
Default behaviour:
- tag-like taxonomies are edited through a text field with autosuggest - terminput
- category-like taxonomies are edited through a dropdown - termselect
If you would like to use the autosuggest for all taxonomies, paste the following code in your theme's functions.php file
function fee_choose_taxonomy_interface( $data ) {
if ( isset( $data['taxonomy'] ) ) )
$data['type'] = 'terminput';
return $data;
}
add_filter( 'front_end_editor_wrap', 'fee_choose_taxonomy_interface' );
If you would like to choose which taxonomy gets which interface, you can do it with the following snippet of code:
function fee_choose_taxonomy_interface( $data ) {
if ( isset( $data['taxonomy'] ) ) {
if ( 'taxonomy_a' == $data['taxonomy'] )
$data['type'] = 'termselect';
elseif ( 'taxonomy_b' == $data['taxonomy'] )
$data['type'] = 'terminput';
elseif ( 'taxonomy_b' == $data['taxonomy'] )
$data['type'] = 'terminput';
// etc.
}
return $data;
}
add_filter( 'front_end_editor_wrap', 'fee_choose_taxonomy_interface' );