$box ) :
if ( !empty( $box['page'] ) ) :
global $post;
$altPage = ( function_exists('pll_get_post') ) ? pll_get_post($box['page']) : $box['page'];
foreach( $content_blocks_query->posts as $post ) :
if ( $box['page'] == $post->ID || $altPage == $post->ID ) :
// Init
setup_postdata( $post );
$visual = $visualtype = '';
$box['icon_style'] = ( isset( $box['icon_style'] ) ) ? $box['icon_style'] : 'none';
// Refresh user style (to add future op of diff styles for each block)
$style = $userstyle;
// Style-3 exceptions: doesnt work great with icons of 'None' style, or with images or with no visual at all. So revert to Style-2 for this scenario.
if ( $style == 'style3' ) {
if ( !empty( $box['icon'] ) ) {
if ( $box['icon_style'] == 'none' ) $style = 'style2';
} else $style = 'style2';
}
// Set image or icon
if ( !empty( $box['icon'] ) ) {
$visualtype = 'icon';
$visual = '
';
} elseif ( has_post_thumbnail() ) {
$visualtype = 'image';
if ( $style == 'style4' ) {
switch ( $columns ) {
case 1: $img_size = 2; break;
case 2: $img_size = 4; break;
default: $img_size = 5;
}
} else {
$img_size = $columns;
}
$img_size = hoot_thumbnail_size( 'column-1-' . $img_size );
$img_size = apply_filters( 'content_block_img', $img_size, $columns, $style );
$visual = 1;
}
// Set Block Class (if no visual for style 2/3, then dont highlight)
$block_class = ( !empty( $visual ) && ( $style == 'style2' || $style == 'style3' ) ) ? 'highlight-typo' : 'no-highlight';
// Set URL
if ( !empty( $box['excerpt'] ) && empty( $box['url'] ) ) {
$linktag = '
';
} else {
$linktag = $linktagend = '';
}
// Start Block Display
if ( $column == 1 ) echo '
';
?>
' . $linktag . esc_html( $linktext ) . $linktagend . '';
?>
';
$column = $clearfix = 1;
} else {
$clearfix = false;
$column++;
}
break;
endif;
endforeach;
wp_reset_postdata();
endif;
endforeach;
if ( !$clearfix ) echo '