Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
WPAlchemy meta definitions for project-meta
<div class="my_meta_control">
<a style="float:right; margin:0 10px;" href="#" class="dodelete-links button remove-all">Remove All</a>
<label>Project Staff<span>(current Staff associated with the project)</span></label>
<p>Add staff to project by selecting them from the dropdown. Add addtional staff by clicking the "Add Staff" button.</p>
$people_query_args = array(
'post_type' => 'people',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC',
$people_query = new WP_Query( $people_query_args );
$staff_arr = array();
if ( $people_query->have_posts() )
while ( $people_query->have_posts() )
array_push( $staff_arr, array( 'id' => $post->ID , 'title' => $post->post_title ) );
<?php while($mb->have_fields_and_multi('links')): ?>
<?php $mb->the_group_open(); ?>
<?php $mb->the_field( 'projectstaff' ); ?>
<select name="<?php $mb->the_name(); ?>">
<option value="">Select...</option>
<?php foreach( $staff_arr as $staff ) { ?>
<option value="<?php echo $staff['id']; ?>"<?php $mb->the_select_state($staff['id']); ?>><?php echo $staff['title']; ?></option>
<?php } ?>
<p class="remove-button"><a href="#" class="dodelete button remove">Remove Link</a></p>
<br clear="all" />
<?php $mb->the_group_close(); ?>
<?php endwhile; ?>
<p class="add-another-link"><a href="#" class="docopy-links button add-another">Add Link</a></p>
$project_mb = new WPAlchemy_MetaBox(array(
'id' => '_project_details',
'title' => 'Project Details',
'types' => array('project'),
'context' => 'normal',
'priority' => 'high',
'template' => get_stylesheet_directory() . '/metaboxes/project-meta.php'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.