Created
December 22, 2010 23:37
-
-
Save anonymous/752300 to your computer and use it in GitHub Desktop.
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
// CUSTOM METABOX PRESENTERS | |
$custom_metabox_presenters = new WPAlchemy_MetaBox(array ( | |
'id' => '_presenters-metaboxes', // underscore prefix hides fields from the custom fields area | |
'title' => 'Presenters', // title added automatically to the custom metabox | |
'types' => array('recording'), // added only for custom post type "name-of-post-type" can also be "page" or "post" | |
'context' => 'side', // same as above, defaults to "normal" but can use "advanced" or "side" | |
'priority' => 'low', // same as above, defaults to "high" but can use "low" as well | |
'mode' => WPALCHEMY_MODE_EXTRACT, | |
'save_action' => 'save_presenters_terms', | |
'template' => TEMPLATEPATH . '/classes/WPAlchemy/custom/presenters.php' // contents for the meta box | |
)); | |
function save_presenters_terms($meta, $post_id) { | |
wp_set_post_terms($post_id, array($meta['choose_presenters']), 'presenters', FALSE); | |
} | |
// Code in Template | |
<div class="my_meta_control"> | |
<?php $presenters = get_terms('presenters', 'hide_empty=0'); ?> | |
<?php $mb->the_field('choose_presenters'); ?> | |
<?php foreach ($presenters as $presenter): ?> | |
<input type="checkbox" name="<?php $mb->the_name(); ?>" value="<?php echo $presenter->name; ?>"<?php $mb->the_checkbox_state($presenter->name); ?>/> <?php echo $presenter->name; ?><br/> | |
<?php endforeach; ?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment