public
Created — forked from kirstenkeister/project-meta.php

WPAlchemy meta definitions for project-meta

  • Download Gist
project-meta.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
<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>
 
<?php
 
$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() )
{
$people_query->the_post();
 
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 } ?>
</select>
<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>
 
</div>
project-spec.php
PHP
1 2 3 4 5 6 7 8 9
$project_mb = new WPAlchemy_MetaBox(array(
'id' => '_project_details',
'title' => 'Project Details',
'types' => array('project'),
'context' => 'normal',
'priority' => 'high',
'mode' => WPALCHEMY_MODE_EXTRACT,
'template' => get_stylesheet_directory() . '/metaboxes/project-meta.php'
));

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.