<?php 
get_header();
imic_sidebar_position_module();
if(is_home()) { $id = get_option('page_for_posts'); }
else { $id = get_the_ID(); }
$page_header = get_post_meta($id,'imic_pages_Choose_slider_display',true);
if($page_header==3) {
	get_template_part( 'pages', 'flex' );
}
elseif($page_header==4) {
	get_template_part( 'pages', 'nivo' );
}
elseif($page_header==5) {
	get_template_part( 'pages', 'revolution' );
}
else {
	get_template_part( 'pages', 'banner' );
}
$pageSidebarGet = get_post_meta(get_the_ID(),'imic_select_sidebar_from_list', true);
$pageSidebarStrictNo = get_post_meta(get_the_ID(),'imic_strict_no_sidebar', true);
$pageSidebarOpt = $imic_options['staff_sidebar'];
if($pageSidebarGet != ''){
	$pageSidebar = $pageSidebarGet;
}elseif($pageSidebarOpt != ''){
	$pageSidebar = $pageSidebarOpt;
}else{
	$pageSidebar = '';
}
if($pageSidebarStrictNo == 1){
	$pageSidebar = '';
}
$sidebar_column = get_post_meta(get_the_ID(),'imic_sidebar_columns_layout',true);
if($sidebar_column != ''){
	$sidebar_column = $sidebar_column;	
} else {
	$sidebar_column = 4;	
}
if(!empty($pageSidebar)&&is_active_sidebar($pageSidebar)) {
$left_col = 12-$sidebar_column;
$class = $left_col;  
}else{
$class = 12;  
}
?>
<!-- Start Body Content -->
  	<div class="main" role="main">
    	<div id="content" class="content full">
        	<div class="container">
                <div class="row">
                	<div class="col-md-<?php echo $class; ?>" id="content-col">
                        <article class="single-staff-post format-standard">
                      			<?php if(have_posts()):while ( have_posts() ) : the_post();
									$staff_position = get_post_meta(get_the_ID(),'imic_staff_position',true);
									$social = imic_social_staff_icon();
									the_post_thumbnail('full');
									echo '<div class="spacer-30"></div>';
									echo '<div class="pull-right">'.$social.'</div>';
									echo '<span class="label label-default">'.$staff_position.'</span>';
									echo '<div class="spacer-20"></div>';
									the_content();
									$url = imic_get_template_url('template-speakers-sermon.php');
									if($url!='') {
										echo '<a class="btn btn-primary" href="'.add_query_arg('speakers',get_the_ID(),$url).'">'.__('View all Sermons','framework').'</a>'; }
								endwhile;
								
								 endif; ?>
                            <?php if ($imic_options['switch_sharing'] == 1 && $imic_options['share_post_types']['5'] == '1') { ?>
								<?php imic_share_buttons(); ?>
                            <?php } ?>
                        </article>
                    </div>
                    	<?php if(is_active_sidebar($pageSidebar)) { ?>
                    <!-- Sidebar -->
                    <div class="col-md-<?php echo $sidebar_column; ?>" id="sidebar-col">
                    	<?php dynamic_sidebar($pageSidebar); ?>
                    </div>
                    <?php } ?>
                        </div>
                    </div>
                </div>
         	</div>
    <!-- End Body Content -->
<?php get_footer(); ?>