<?php
/*
Intense Template Name: Four Columns (text w/ Lightbox)
*/

global $post, $intense_custom_post, $intense_visions_options;

$inline = ( is_sticky() && 'inline' == $intense_custom_post['sticky_mode'] );

if ( $inline ) {
	$span = "12";
	$size = "postWide";
	$header_tag = "h3";
} else {
	$span = "3";
	$size = ( isset( $intense_custom_post['image_size'] ) ? $intense_custom_post['image_size'] : 'medium640' );
	$header_tag = "h4";
}

$padding_bottom = $intense_visions_options['intense_layout_row_default_padding']['padding-top'];
$intense_post_type = $intense_custom_post['post_type'];
$random_id = 'img_' . rand();
$content = '';
$lightbox_content = '';

if ( $intense_custom_post['show_images'] ) { 
	$image = get_field( 'intense_member_photo' );

	if( !empty( $image ) ) {
		$content .= "<div style='padding:10px 0;'>" . intense_run_shortcode( 'intense_image', array( 'size' => ( $intense_custom_post['image_size'] === '' ? 'medium500' : $intense_custom_post['image_size'] ), 'image' => $image["id"], 'border_radius' => ( $intense_custom_post['image_border_radius'] === '' ? '0px' : $intense_custom_post['image_border_radius'] ) ) ) . "</div>";
	}
}

$content .= "<center><" .  $header_tag . " class='entry-title' style='margin:10px 0;'>" . the_title_attribute( 'echo=0' ) . "</" . $header_tag . "><div class='entry-content'>";		

if ( get_field( 'intense_member_title' ) != '' ) {
	$content .= '<h4>' . get_field( 'intense_member_title' ) . '</h4>';
}

$content .= "</div></center>";

$lightbox_content .= '[intense_row padding_top="0" padding_bottom="20"][intense_column size="3" medium_size="3" small_size="12" extra_small_size="12"]';
$lightbox_content .= intense_run_shortcode( 'intense_image', array( 'size' => ( $intense_custom_post['image_size'] === '' ? 'medium500' : $intense_custom_post['image_size'] ), 'image' => $image["id"], 'border_radius' => ( $intense_custom_post['image_border_radius'] === '' ? '0px' : $intense_custom_post['image_border_radius'] ) ) );
$lightbox_content .= '[/intense_column]';
$lightbox_content .= '[intense_column size="9" medium_size="9" small_size="12" extra_small_size="12"]';
$lightbox_content .= "<" .  $header_tag . " class='entry-title' style='margin:10px 0;'>" . the_title_attribute( 'echo=0' ) . "</" . $header_tag . ">" . '<h4>' . get_field( 'intense_member_title' ) . '</h4>';
$lightbox_content .= '[/intense_column]';
$lightbox_content .= '[/intense_row]';
$lightbox_content .= get_the_content();
?>
<div class='intense col-lg-<?php echo $span; ?> col-md-<?php echo $span; ?> col-sm-6 col-xs-12  <?php echo $intense_custom_post['post_classes']; ?> intense_post nogutter' style='margin-left: 0px; float: none; padding: 0 10px; padding-bottom: <?php echo $padding_bottom ?>; display:inline-block; vertical-align: top;'>
	<article id='post-<?php echo $post->ID; ?>' class='<?php echo ( $inline ?  'featured ' : '' ); ?>'>
	<?php echo $intense_custom_post['animation_wrapper_start']; ?>
		<?php 
			echo intense_run_shortcode( 'intense_lightbox', array( 'type' => 'magnificpopup' , 'content_type' => 'html', 'html_element' => $random_id ), $content );
		?>
		<div id='<?php echo $random_id; ?>' style='width:800px; padding:30px 15px; background-color:#ffffff; margin:0 auto;'>
		<?php
			echo do_shortcode( $lightbox_content );
		?>
		</div>
	<?php echo $intense_custom_post['animation_wrapper_end']; ?>
	</article>
</div>