Created
December 31, 2011 05:36
-
-
Save jbreitenbucher/1543014 to your computer and use it in GitHub Desktop.
Code to return data from multicheck taxonomy field
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
$styles = get_post_meta($post->ID, 'it_classroom_style_taxonomy',true) ; | |
echo $styles[0]; | |
$style = get_term_by( 'id', $styles[0], 'style' );//get_term($styles[0], 'style'); | |
print_r($style); | |
echo $style->name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This taxonomy returns the correct name
register_taxonomy(
'building',
'itclassroom',
array(
'hierarchical' => false,
'labels' => $labels_building,
'query_var' => true,
'rewrite' => array( 'slug' => 'buildings', 'with_front' => false ),
)
);
and this one is not
register_taxonomy(
'style',
'itclassroom',
array(
'hierarchical' => false,
'labels' => $labels_classroom,
'query_var' => true,
'rewrite' => array( 'slug' => 'classroom-styles', 'with_front' => false ),
)
);
The metaboxes are generated with
array(
'name' => 'Building',
'desc' => '',
'id' => $prefix . 'building_taxonomy',
'taxonomy' => 'building', //Enter Taxonomy Slug
'type' => 'taxonomy_radio',
),
and
array(
'name' => 'Classroom Style',
'desc' => '',
'id' => $prefix . 'classroom_style_taxonomy',
'taxonomy' => 'style', //Enter Taxonomy Slug
'type' => 'taxonomy_multicheck',
),