<?php
/*
Template Name: Music Releases
*/
?>
<div class="widget_wrapper">
<h2 class="widgettitle">Releases</h2>
<?php $music_releases = new WP_Query(array('post_type' => 'eprmusicrelease')); ?>
<?php if($music_releases->have_posts()): while ($music_releases->have_posts() ) : $music_releases->the_post(); ?>
<?php if($album_url = get_post_meta($post->ID, 'meta_box_musicreleases_url', true)): ?>
<?php $album_size = get_post_meta( $post->ID,'meta_box_musicreleases_albumsize',true ); ?>
<?php if($album_size == 'album_small'): ?>
<div class="release_small">
<a href="<?php echo esc_url($album_url); ?>" title="<?php the_title_attribute(); ?>" target="_blank"></a>
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-sm'); ?>
</div>
<?php elseif($album_size == 'album_large'): ?>
<div class="release_large">
<a href="<?php echo esc_url($album_url); ?>" title="<?php the_title_attribute(); ?>" target="_blank"></a>
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-sm'lrg'); ?>
</div>
<?php elseif($album_size == 'album_large')else: ?>
<!-- no radio button selected -->
<div class="release_large">
<a href="<?php echo esc_url($album_url); ?>" title="<?php the_title_attribute(); ?>" target="_blank"></a>
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-lg'lrg'); ?>
</div>
<?php else: ?>
<?php endif; ?>
<?php else: ?>
<?php $album_size = get_post_meta( $post->ID,'meta_box_musicreleases_albumsize',true ); ?>
<?php if($album_size == 'album_small'): ?>
<div class="release_small">
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-sm'); ?>
</div>
<?php elseif($album_size == 'album_large'): ?>
<div class="release_large">
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-sm'lrg'); ?>
</div>
<?php elseif($album_size == 'album_large'): ?>
<?php else: ?>
<!-- no radio button selected -->
<div class="release_large">
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-lg'lrg'); ?>
</div>
<?php else: ?>
<?php endif; ?>
<?php endif; ?>
<?php endwhile; else: // NO POSTS // ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
</div>
<?php
/*
Template Name: Music Releases
*/
?>
<div class="widget_wrapper">
<h2 class="widgettitle">Releases</h2>
<?php $music_releases = new WP_Query(array('post_type' => 'eprmusicrelease')); ?>
<?php if($music_releases->have_posts()): while ($music_releases->have_posts() ) : $music_releases->the_post(); ?>
<?php if($album_url = get_post_meta($post->ID, 'meta_box_musicreleases_url', true)): ?>
<?php $album_size = get_post_meta( $post->ID,'meta_box_musicreleases_albumsize',true ); ?>
<?php if($album_size == 'album_small'): ?>
<div class="release_small">
<a href="<?php echo esc_url($album_url); ?>" title="<?php the_title_attribute(); ?>" target="_blank"></a>
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-sm'); ?>
</div>
<?php elseif($album_size == 'album_large'): ?>
<div class="release_large">
<a href="<?php echo esc_url($album_url); ?>" title="<?php the_title_attribute(); ?>" target="_blank"></a>
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-lg'); ?>
</div>
<?php else: ?>
<?php endif; ?>
<?php else: ?>
<?php $album_size = get_post_meta( $post->ID,'meta_box_musicreleases_albumsize',true ); ?>
<?php if($album_size == 'album_small'): ?>
<div class="release_small">
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-sm'); ?>
</div>
<?php elseif($album_size == 'album_large'): ?>
<div class="release_large">
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-lg'); ?>
</div>
<?php else: ?>
<?php endif; ?>
<?php endif; ?>
<?php endwhile; else: // NO POSTS // ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
</div>
<?php
/*
Template Name: Music Releases
*/
?>
<div class="widget_wrapper">
<h2 class="widgettitle">Releases</h2>
<?php $music_releases = new WP_Query(array('post_type' => 'eprmusicrelease')); ?>
<?php if($music_releases->have_posts()): while ($music_releases->have_posts() ) : $music_releases->the_post(); ?>
<?php if($album_url = get_post_meta($post->ID, 'meta_box_musicreleases_url', true)): ?>
<?php $album_size = get_post_meta( $post->ID,'meta_box_musicreleases_albumsize',true ); ?>
<?php if($album_size == 'album_small'): ?>
<div class="release_small">
<a href="<?php echo esc_url($album_url); ?>" title="<?php the_title_attribute(); ?>" target="_blank"></a>
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-sm'); ?>
</div>
<?php elseif($album_size == 'album_large'): ?>
<div class="release_large">
<a href="<?php echo esc_url($album_url); ?>" title="<?php the_title_attribute(); ?>" target="_blank"></a>
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-lrg'); ?>
</div>
<?php else: ?>
<!-- no radio button selected -->
<div class="release_large">
<a href="<?php echo esc_url($album_url); ?>" title="<?php the_title_attribute(); ?>" target="_blank"></a>
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-lrg'); ?>
</div>
<?php endif; ?>
<?php else: ?>
<?php $album_size = get_post_meta( $post->ID,'meta_box_musicreleases_albumsize',true ); ?>
<?php if($album_size == 'album_small'): ?>
<div class="release_small">
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-sm'); ?>
</div>
<?php elseif($album_size == 'album_large'): ?>
<div class="release_large">
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-lrg'); ?>
</div>
<?php else: ?>
<!-- no radio button selected -->
<div class="release_large">
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-lrg'); ?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php endwhile; else: // NO POSTS // ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
</div>
Here is what i have for my meta box (UPDATED):
<?php
// Register Custom Post Type Meta Box for EPR Music Releases CPT -- Album Sizes
add_action( 'add_meta_boxes', 'musicreleases_featrelease_meta_box_add''musicreleases_albumsize_meta_box_add' );
function musicreleases_featrelease_meta_box_addmusicreleases_albumsize_meta_box_add()
{
add_meta_box( 'musicreleases_featrelease_meta_id''musicreleases_albumsize_meta_id', 'Featured'Album Release?'Size', 'musicreleases_featrelease_meta_box_cb''musicreleases_albumsize_meta_box_cb', 'eprmusicrelease', 'normal', 'low' );
}
function musicreleases_featrelease_meta_box_cbmusicreleases_albumsize_meta_box_cb( $post )
{
$value = get_post_meta( $post->ID,'meta_box_musicreleases_featrelease''meta_box_musicreleases_albumsize',true );
wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );
?>
<p>
<input type="radio" name="featrelease"name="albumsize" value="display_lrg_release"value="album_small" <?php echo ($value == 'display_lrg_release''album_small')? 'checked="checked"':''; ?>/> Yes<brSmall<br />
<input type="radio" name="featrelease"name="albumsize" value="display_sm_release"value="album_large" <?php echo ($value == 'display_sm_release''album_large')? 'checked="checked"':''; ?>/> No<brLarge<br />
</p>
<?php
}
add_action( 'save_post', 'musicreleases_featrelease_meta_box_save''musicreleases_albumsize_meta_box_save' );
function musicreleases_featrelease_meta_box_savemusicreleases_albumsize_meta_box_save( $post_id ){
if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;
if( !current_user_can( 'edit_post' ) ) return;
//accepted values whitelist
$allowed = array('display_lrg_release''album_small','display_sm_release''album_large');
if( isset( $_POST['featrelease']$_POST['albumsize'] ) && in_array($_POST['featrelease']$_POST['albumsize'], $allowed))
update_post_meta( $post_id, 'meta_box_musicreleases_featrelease''meta_box_musicreleases_albumsize', $_POST['featrelease']$_POST['albumsize'] );
}
?>
This is my current template which I need to add this data to for the front end (UPDATED):
<?php
/*
Template Name: Music Releases
*/
?>
<div class="widget_wrapper">
<h2 class="widgettitle">Releases</h2>
<?php $music_releases = new WP_Query(array('post_type' => 'eprmusicrelease')); ?>
<?php if($music_releases->have_posts()): while ($music_releases->have_posts() ) : $music_releases->the_post(); ?>
<?php if($album_url = get_post_meta($post->ID, 'meta_box_musicreleases_url', true)): ?>
<?php $album_size = get_post_meta( $post->ID,'meta_box_musicreleases_albumsize',true ); ?>
<?php if($album_size == 'album_small'): ?>
<div class="featured_release">class="release_small">
<a href="<?php echo esc_url($album_url); ?>" title="<?php the_title_attribute(); ?>" target="_blank"></a>
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img'img-sm'); ?>
</div>
<?php elseif($album_size == 'album_large'): ?>
<div class="release_large">
<a href="<?php echo esc_url($album_url); ?>" title="<?php the_title_attribute(); ?>" target="_blank"></a>
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-lg'); ?>
</div>
<?php else: ?>
<?php endif; ?>
<?php else: ?>
<?php $album_size = get_post_meta( $post->ID,'meta_box_musicreleases_albumsize',true ); ?>
<?php if($album_size == 'album_small'): ?>
<div class="featured_release">class="release_small">
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-sm'); ?>
</div>
<?php elseif($album_size == 'album_large'): ?>
<div class="release_large">
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img'img-lg'); ?>
</div>
<?php else: ?>
<?php endif; ?>
<?php endif; ?>
<?php endwhile; else: // NO POSTS // ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
</div>
Here is what i have for my meta box:
<?php
add_action( 'add_meta_boxes', 'musicreleases_featrelease_meta_box_add' );
function musicreleases_featrelease_meta_box_add()
{
add_meta_box( 'musicreleases_featrelease_meta_id', 'Featured Release?', 'musicreleases_featrelease_meta_box_cb', 'eprmusicrelease', 'normal', 'low' );
}
function musicreleases_featrelease_meta_box_cb( $post )
{
$value = get_post_meta( $post->ID,'meta_box_musicreleases_featrelease',true );
wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );
?>
<p>
<input type="radio" name="featrelease" value="display_lrg_release" <?php echo ($value == 'display_lrg_release')? 'checked="checked"':''; ?>/> Yes<br />
<input type="radio" name="featrelease" value="display_sm_release" <?php echo ($value == 'display_sm_release')? 'checked="checked"':''; ?>/> No<br />
</p>
<?php
}
add_action( 'save_post', 'musicreleases_featrelease_meta_box_save' );
function musicreleases_featrelease_meta_box_save( $post_id ){
if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;
if( !current_user_can( 'edit_post' ) ) return;
//accepted values whitelist
$allowed = array('display_lrg_release','display_sm_release');
if( isset( $_POST['featrelease'] ) && in_array($_POST['featrelease'], $allowed))
update_post_meta( $post_id, 'meta_box_musicreleases_featrelease', $_POST['featrelease'] );
}
?>
This is my current template which I need to add this data to for the front end:
<?php
/*
Template Name: Music Releases
*/
?>
<div class="widget_wrapper">
<h2 class="widgettitle">Releases</h2>
<?php $music_releases = new WP_Query(array('post_type' => 'eprmusicrelease')); ?>
<?php if($music_releases->have_posts()): while ($music_releases->have_posts() ) : $music_releases->the_post(); ?>
<?php if($album_url = get_post_meta($post->ID, 'meta_box_musicreleases_url', true)): ?>
<div class="featured_release">
<a href="<?php echo esc_url($album_url); ?>" title="<?php the_title_attribute(); ?>" target="_blank"></a>
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img'); ?>
</div>
<?php else: ?>
<div class="featured_release">
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img'); ?>
</div>
<?php endif; ?>
<?php endwhile; else: // NO POSTS // ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
</div>
Here is what i have for my meta box (UPDATED):
<?php
// Register Custom Post Type Meta Box for EPR Music Releases CPT -- Album Sizes
add_action( 'add_meta_boxes', 'musicreleases_albumsize_meta_box_add' );
function musicreleases_albumsize_meta_box_add()
{
add_meta_box( 'musicreleases_albumsize_meta_id', 'Album Size', 'musicreleases_albumsize_meta_box_cb', 'eprmusicrelease', 'normal', 'low' );
}
function musicreleases_albumsize_meta_box_cb( $post )
{
$value = get_post_meta( $post->ID,'meta_box_musicreleases_albumsize',true );
wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );
?>
<p>
<input type="radio" name="albumsize" value="album_small" <?php echo ($value == 'album_small')? 'checked="checked"':''; ?>/> Small<br />
<input type="radio" name="albumsize" value="album_large" <?php echo ($value == 'album_large')? 'checked="checked"':''; ?>/> Large<br />
</p>
<?php
}
add_action( 'save_post', 'musicreleases_albumsize_meta_box_save' );
function musicreleases_albumsize_meta_box_save( $post_id ){
if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;
if( !current_user_can( 'edit_post' ) ) return;
//accepted values whitelist
$allowed = array('album_small','album_large');
if( isset( $_POST['albumsize'] ) && in_array($_POST['albumsize'], $allowed))
update_post_meta( $post_id, 'meta_box_musicreleases_albumsize', $_POST['albumsize'] );
}
?>
This is my current template which I need to add this data to for the front end (UPDATED):
<?php
/*
Template Name: Music Releases
*/
?>
<div class="widget_wrapper">
<h2 class="widgettitle">Releases</h2>
<?php $music_releases = new WP_Query(array('post_type' => 'eprmusicrelease')); ?>
<?php if($music_releases->have_posts()): while ($music_releases->have_posts() ) : $music_releases->the_post(); ?>
<?php if($album_url = get_post_meta($post->ID, 'meta_box_musicreleases_url', true)): ?>
<?php $album_size = get_post_meta( $post->ID,'meta_box_musicreleases_albumsize',true ); ?>
<?php if($album_size == 'album_small'): ?>
<div class="release_small">
<a href="<?php echo esc_url($album_url); ?>" title="<?php the_title_attribute(); ?>" target="_blank"></a>
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-sm'); ?>
</div>
<?php elseif($album_size == 'album_large'): ?>
<div class="release_large">
<a href="<?php echo esc_url($album_url); ?>" title="<?php the_title_attribute(); ?>" target="_blank"></a>
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-lg'); ?>
</div>
<?php else: ?>
<?php endif; ?>
<?php else: ?>
<?php $album_size = get_post_meta( $post->ID,'meta_box_musicreleases_albumsize',true ); ?>
<?php if($album_size == 'album_small'): ?>
<div class="release_small">
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-sm'); ?>
</div>
<?php elseif($album_size == 'album_large'): ?>
<div class="release_large">
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img-lg'); ?>
</div>
<?php else: ?>
<?php endif; ?>
<?php endif; ?>
<?php endwhile; else: // NO POSTS // ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
</div>
How to check for specific meta box value on front end and output accordingly
I have a custom meta box with two different radio buttons that can be selected. One is for displaying the content in a "large' format, the other is for displaying content in a "small" format on the front end.
I already know how to retrieve a meta box's data and output it, but not how to "check" what specific data has been selected, and how to that output according to what value has been selected. (It should be noted that I will be using this data to output a specific CSS class that can then be applied to a different block of code designated for that selection)
Here is what i have for my meta box:
<?php
add_action( 'add_meta_boxes', 'musicreleases_featrelease_meta_box_add' );
function musicreleases_featrelease_meta_box_add()
{
add_meta_box( 'musicreleases_featrelease_meta_id', 'Featured Release?', 'musicreleases_featrelease_meta_box_cb', 'eprmusicrelease', 'normal', 'low' );
}
function musicreleases_featrelease_meta_box_cb( $post )
{
$value = get_post_meta( $post->ID,'meta_box_musicreleases_featrelease',true );
wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );
?>
<p>
<input type="radio" name="featrelease" value="display_lrg_release" <?php echo ($value == 'display_lrg_release')? 'checked="checked"':''; ?>/> Yes<br />
<input type="radio" name="featrelease" value="display_sm_release" <?php echo ($value == 'display_sm_release')? 'checked="checked"':''; ?>/> No<br />
</p>
<?php
}
add_action( 'save_post', 'musicreleases_featrelease_meta_box_save' );
function musicreleases_featrelease_meta_box_save( $post_id ){
if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;
if( !current_user_can( 'edit_post' ) ) return;
//accepted values whitelist
$allowed = array('display_lrg_release','display_sm_release');
if( isset( $_POST['featrelease'] ) && in_array($_POST['featrelease'], $allowed))
update_post_meta( $post_id, 'meta_box_musicreleases_featrelease', $_POST['featrelease'] );
}
?>
...As you can see, the meta box allows the user to select whether the album is to be displayed as a LARGE or SMALL release.
This is my current template which I need to add this data to for the front end:
<?php
/*
Template Name: Music Releases
*/
?>
<div class="widget_wrapper">
<h2 class="widgettitle">Releases</h2>
<?php $music_releases = new WP_Query(array('post_type' => 'eprmusicrelease')); ?>
<?php if($music_releases->have_posts()): while ($music_releases->have_posts() ) : $music_releases->the_post(); ?>
<?php if($album_url = get_post_meta($post->ID, 'meta_box_musicreleases_url', true)): ?>
<div class="featured_release">
<a href="<?php echo esc_url($album_url); ?>" title="<?php the_title_attribute(); ?>" target="_blank"></a>
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img'); ?>
</div>
<?php else: ?>
<div class="featured_release">
<?php if($url_type = get_post_meta($post->ID, 'meta_box_musicreleases_linktype', true)): ?>
<div class="<?php echo ($url_type); ?>"></div>
<?php else: ?>
<?php endif; ?>
<?php the_post_thumbnail('music-release-img'); ?>
</div>
<?php endif; ?>
<?php endwhile; else: // NO POSTS // ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
</div>