Skip to content

Instantly share code, notes, and snippets.

@mbijon
Created April 3, 2013 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbijon/5306098 to your computer and use it in GitHub Desktop.
Save mbijon/5306098 to your computer and use it in GitHub Desktop.
New field hardcoded into Custom MetaBox Fields add-on, v0.9.2
case 'layout_chooser':
echo '<ul id="form_template_options" class="">';
$tv_donate_class = new TVDonate;
$tv_views_list = $tv_donate_class->return_tv_views_list();
// Arrays of settings & layouts
include( plugin_dir_path( dirname( dirname( __FILE__ ) ) ) . 'tv-donate-settings.php' );
$tv_views_list = $this->tv_views_list;
if ( ! empty( $tv_views_list ) ) {
$i = 0; // Counter for HTML IDs
foreach( $tv_views_list as $view_meta ) {
$thumbnail = __( $view_meta['image'], "tv-donate" );
?><li class="thumb-tile">
<div class="thumb-preview">
<div class="thumbnail" style="background-image: url('<?php echo plugins_url( 'images/' . $thumbnail, dirname( dirname( __FILE__ ) ) ); ?>'); border: 1px solid #aaa;">
</div>
</div>
<input type="radio" name="<?php echo $field['id']; ?>" id="<?php echo $field['id'] . $i; ?>" value="<?php _e( $i ); ?>"<?php echo $meta == $i ? ' checked="checked"' : ''; ?>">
<h4><?php _e( $view_meta['title'], "tv-donate" ); ?></h4>
</li>
<?php
$i++;
}
} else {
echo '<p>' . _e( "There are no layout files. Please update or re-install the &lsquo;TV Donate&rsquo; plugin.", "tv-donate" ) . '</p>';
}
echo '</ul>';
break;
default:
do_action('cmb_render_' . $field['type'] , $field, $meta);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment