Skip to content

Instantly share code, notes, and snippets.

@farinspace
Forked from armandmorin/testimonial-meta.php
Created September 1, 2011 15:06
Show Gist options
  • Save farinspace/1186363 to your computer and use it in GitHub Desktop.
Save farinspace/1186363 to your computer and use it in GitHub Desktop.
Metabox Outside of Group
<?php
/**
* NOTE: The radio buttons which determine a css style in my program are CURRENTLY inside the group.
* I am trying to do this OUTSIDE of the group. If I leave it inside the group, I have to define the settings for each testimonial I have. I want to set it once and
* have it define each instance.
*
*/
?>
<div class="mcms_optinpage">
<div class="mcms_testimonial">
<div class='testimonial' style="border:1px solid #ccc;padding:10px;border-radius:2px; margin-bottom: 20px;">
<label>Choose The Testimonial Background Color</label><br/>
<?php $mb->the_field('background'); ?>
<input type="radio" name="<?php $mb->the_name(); ?>" value="testimonialblue"<?php $mb->the_radio_state('testimonialblue'); ?>/><img src="<?php echo WP_PLUGIN_URL. '/mcms/images/testimonialblue.png';?>"/>
<input type="radio" name="<?php $mb->the_name(); ?>" value="testimonialgreen"<?php $mb->the_radio_state('testimonialgreen'); ?>/><img src="<?php echo WP_PLUGIN_URL. '/mcms/images/testimonialgreen.png';?>"/>
<input type="radio" name="<?php $mb->the_name(); ?>" value="testimonialgray"<?php $mb->the_radio_state('testimonialgray'); ?>/><img src="<?php echo WP_PLUGIN_URL. '/mcms/images/testimonialgray.png';?>"/>
<input type="radio" name="<?php $mb->the_name(); ?>" value="testimonialyellow"<?php $mb->the_radio_state('testimonialyellow'); ?>/><img src="<?php echo WP_PLUGIN_URL. '/mcms/images/testimonialyellow.png';?>"/>
</div>
</div>
<?php while( $mb->have_fields_and_multi( 'testimonials' ) ): ?>
<?php $mb->the_group_open(); ?>
<div class="mcms_testimonial">
<div class='testimonial' style="border:1px solid #ccc;padding:10px;border-radius:2px; margin-bottom: 20px;">
<?php $mb->the_field( 'name' ); ?>
<label>Testimonial Name</label><div class='description'>Enter the name of your testimonial.</div>
<p><input type="text" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>" /></p>
<?php $mb->the_field( 'content' ); ?>
<label>The Testimonial</label><div class='description'>Enter the testimonial which your prospect gave you.</div>
<div class="customEditor"><textarea name="<?php $mb->the_name(); ?>"><?php echo $mb->the_value(); ?></textarea></div>
<?php $mb->the_field( 'audio' ); ?>
<label>OPTIONIAL Testimonial Audio Button</label><div class='description'>Enter the URL to the mp3 of your testimonial.</div>
<p><input type="text" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>" /></p>
<a style="margin-bottom: 20px;" href="#" class="dodelete button">Delete Testimonial</a>
</div>
</div>
<?php $mb->the_group_close(); ?>
<?php endwhile; ?>
<p>
<a href="#" class="docopy-testimonials button">Add a New Testimonial</a>
<input type="submit" class="button-primary" name="save"value="Save Testimonial"/>
</p>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment