Skip to content

Instantly share code, notes, and snippets.

@armandmorin
armandmorin / gist:1258146
Created Oct 3, 2011
WPAlchemy sample select box
View gist:1258146
<?php $mb->the_field('font_weight'); ?>
<select name="<?php $mb->the_name(); ?>">
<option value="normal"<?php $mb->the_select_state('normal'); ?>>Normal</option>
<option value="italic"<?php $mb->the_select_state('italic'); ?>>Italic</option>
<option value="bold"<?php $mb->the_select_state('bold'); ?>>Bold</option>
<option value="bolditalic"<?php $mb->the_select_state('bolditalic'); ?>>Bold Italic</option>
</select>
View javscript addition
<script type="text/javascript">
//<![CDATA[
jQuery('body').bind('afterPreWpautop', function(e, o){
o.data = o.unfiltered
.replace(/caption\]\[caption/g, 'caption] [caption')
.replace(/<object[\s\S]+?<\/object>/g, function(a) {
return a.replace(/[\r\n]+/g, ' ');
});
}).bind('afterWpautop', function(e, o){
View testimonial-meta-output.php
<?php
global $testimonial_metabox;
while( $testimonial_metabox->have_fields( 'testimonials' ) )
{
echo '<div class="';
echo $testimonial_metabox->the_field('background');
echo $testimonial_metabox->the_value();
echo '">';
echo wpautop($testimonial_metabox->get_the_value('content'));
@armandmorin
armandmorin / testimonial-meta.php
Created Sep 1, 2011
Metabox Outside of Group
View testimonial-meta.php
<?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">