<?php
/**
 * Template Name: Multi Page Template
 * @package WordPress
 * @subpackage Deep
**/
get_header(); deep_print_menu(); 

	$deep_thisPostID = get_the_ID(); $deep_color_code = get_option("deep_style_color");

	if (get_post_meta($deep_thisPostID, "deep_enable_custom_pagetitle_options_value", true) == "no" || !get_post_meta($deep_thisPostID, "deep_enable_custom_pagetitle_options_value", true)){
		$type = get_option("deep_header_type");
		$thecolor = deep_hex2rgb(str_replace("__USE_THEME_MAIN_COLOR__", $deep_color_code, get_option("deep_header_color"))); 
		$opacity = intval(str_replace("%","",get_option("deep_header_opacity")))/100;
		$color = "rgba(".$thecolor[0].",".$thecolor[1].",".$thecolor[2].",".$opacity.")";
		$image = get_option("deep_header_image"); 
		$background_position = get_option("deep_pagetitle_background_position");
		$pattern = get_option("deep_header_pattern"); 
		$custompattern = get_option("deep_header_custom_pattern"); 
		$margintop = get_option("deep_header_text_margin_top");	
		$banner = get_option("deep_banner_slider");
		$showtitle = get_option("deep_hide_pagetitle") == "on" ? true : false;
		$showsectitle = get_option("deep_hide_sec_pagetitle") == "on" ? true : false;
		$tcolor = get_option("deep".'_header_text_color');
		$tsize = intval(str_replace(" ", "", get_option("deep".'_header_text_size')),10)."px";
		
		/* New 4.0 */
		$letterspacing = str_replace(" ", "", get_option("deep".'_header_text_letterspacing'));
		$titlelineheight = get_option("deep".'_header_text_lineheight');
		$titletransform = get_option("deep_header_text_transform");
		
		$titlesecletterspacing = str_replace(" ", "", get_option("deep".'_secondary_title_text_letterspacing'));
		$titleseclineheight = get_option("deep".'_secondary_title_text_lineheight');
		$titlesectransform = get_option("deep_secondary_title_text_transform");

		$tfont = get_option("deep".'_header_text_font');
		$stcolor = get_option("deep".'_secondary_title_text_color');
		$stsize = intval(str_replace(" ", "", get_option("deep".'_secondary_title_text_size')),10)."px";
		$stfont = get_option("deep".'_secondary_title_font');
		$stmargin = intval(str_replace(" ", "", get_option("deep".'_header_sec_text_margin_top')),10)."px";
		$originalalign = get_option("deep_header_text_alignment");
		$pt_parallax = get_option("deep_pagetitle_image_parallax") == "on" ? true : false;
		$pt_overlay = get_option("deep_pagetitle_image_overlay") == "on" ? true : false;
		$pt_overlay_type = get_option("deep_pagetitle_overlay_type");
		$pt_overlay_the_color = deep_hex2rgb(str_replace("__USE_THEME_MAIN_COLOR__", $deep_color_code, get_option("deep_pagetitle_overlay_color")));
		$pt_overlay_pattern = (is_string(get_option("deep_pagetitle_overlay_pattern"))) ? DEEP_PATTERNS_URL.get_option("deep_pagetitle_overlay_pattern") : "";
		$pt_overlay_opacity = intval(str_replace("%","",get_option("deep_pagetitle_overlay_opacity")))/100;
		$pt_overlay_color = "rgba(".$pt_overlay_the_color[0].",".$pt_overlay_the_color[1].",".$pt_overlay_the_color[2].",".$pt_overlay_opacity.")";
		$breadcrumbs = get_option("deep_breadcrumbs");
		$breadcrumbs_margintop = get_option('deep_breadcrumbs_text_margin_top');
		$pagetitlepadding = get_option('deep_page_title_padding');
	} else {
		$type = get_post_meta($deep_thisPostID, "deep_header_type_value", true);
		$thecolor = deep_hex2rgb(get_post_meta($deep_thisPostID, "deep_header_color_value", true)); 
		$opacity = intval(str_replace("%","",get_post_meta($deep_thisPostID, "deep_header_color_opacity_value", true)))/100;
		$color = "rgba(".$thecolor[0].",".$thecolor[1].",".$thecolor[2].",".$opacity.")";
		$image = get_post_meta($deep_thisPostID, "deep_header_image_value", true);
		$image = explode('|!|',$image);
		if (isset($image[1])) $image = explode('|*|',$image[1]);
		$image = $image[0];
		$background_position = get_post_meta($deep_thisPostID, "deep_header_background_position_value", true);
		$pattern = DEEP_PATTERNS_URL.get_post_meta($deep_thisPostID, "deep_header_pattern_value", true).".jpg";
		$custompattern = get_option("deep_header_custom_pattern_value"); 
		$margintop = get_post_meta($deep_thisPostID, "deep_header_text_margin_top_value", true);
		$banner = get_post_meta($deep_thisPostID, "deep_banner_slider_value", true);
		$showtitle = get_post_meta($deep_thisPostID, "deep_hide_pagetitle_value", true) == "yes" ? true : false;
		$showsectitle = get_post_meta($deep_thisPostID, "deep_hide_sec_pagetitle_value", true) == "yes" ? true : false;
		$tcolor = get_post_meta($deep_thisPostID, "deep_header_text_color_value", true);
		$tsize = intval(str_replace(" ", "", get_post_meta($deep_thisPostID, "deep_header_text_size_value", true)),10)."px";
		
		/* New 4.0 */
		$letterspacing = str_replace(" ", "", get_post_meta($deep_thisPostID, "deep_header_text_letterspacing_value", true));
		$titlelineheight = get_post_meta($deep_thisPostID, "deep_header_text_lineheight_value", true);
		$titletransform = get_post_meta($deep_thisPostID, "deep_header_text_transform_value", true);

		$titlesecletterspacing = str_replace(" ", "", get_post_meta($deep_thisPostID, "deep_secondary_title_text_letterspacing_value", true));
		$titleseclineheight = get_post_meta($deep_thisPostID, "deep_secondary_title_text_lineheight_value", true);
		$titlesectransform = get_post_meta($deep_thisPostID, "deep_secondary_title_text_transform_value", true);
		
		$tfont = get_post_meta($deep_thisPostID, "deep_header_text_font_value", true);
		$stcolor = get_post_meta($deep_thisPostID, "deep_secondary_title_text_color_value", true);
		$stsize = intval(str_replace(" ", "", get_post_meta($deep_thisPostID, "deep_secondary_title_text_size_value", true)),10)."px";
		$stfont = get_post_meta($deep_thisPostID, "deep_secondary_title_font_value", true);
		$stmargin = intval(str_replace(" ", "", get_post_meta($deep_thisPostID, "deep_header_secondary_text_margin_top_value", true)),10)."px";
		$originalalign = get_post_meta($deep_thisPostID, "deep_header_text_alignment_value", true);
		$pt_parallax = get_post_meta($deep_thisPostID, "deep_pagetitle_image_parallax_value", true) == "on" ? true : false;
		$pt_overlay = get_post_meta($deep_thisPostID, "deep_pagetitle_image_overlay_value", true) == "on" ? true : false;
		$pt_overlay_type = get_post_meta($deep_thisPostID, "deep_pagetitle_overlay_type_value", true);
		$pt_overlay_the_color = deep_hex2rgb(get_post_meta($deep_thisPostID, "deep_pagetitle_overlay_color_value", true));
		$pt_overlay_pattern = DEEP_PATTERNS_URL.get_post_meta($deep_thisPostID, "deep_pagetitle_overlay_pattern_value", true).".jpg";
		$pt_overlay_opacity = intval(str_replace("%","",get_post_meta($deep_thisPostID, "deep_pagetitle_overlay_opacity_value", true)))/100;
		$pt_overlay_color = "rgba(".$pt_overlay_the_color[0].",".$pt_overlay_the_color[1].",".$pt_overlay_the_color[2].",".$pt_overlay_opacity.")";
		$breadcrumbs = get_post_meta($deep_thisPostID, "deep_enable_breadcrumbs_value", true) == "yes" ? "on" : "off";
		$breadcrumbs_margintop = intval(str_replace(" ", "", get_post_meta($deep_thisPostID, "deep_breadcrumbs_margin_top_value", true)),10)."px";
		$pagetitlepadding = intval(str_replace(" ", "", get_post_meta($deep_thisPostID, "deep_page_title_padding_value", true)),10)."px";
	}
	$height = "auto";

	$textalign = $originalalign;
	if ($originalalign == "titlesleftcrumbsright") $textalign = "left";
	if ($originalalign == "titlesrightcrumbsleft") $textalign = "right";

	if (is_array($tfont)) $tfont = ""; $deep_import_fonts[] = $tfont;
	$principalfont = explode("|",$tfont);
	$principalfont[0] = $principalfont[0]."', 'Arial', 'sans-serif";
	if (!isset($principalfont[1])) $principalfont[1] = "";
		
	if (is_array($stfont)) $stfont = ""; $deep_import_fonts[] = $stfont;
	$secondaryfont = explode("|",$stfont);
	$secondaryfont[0] = $secondaryfont[0]."', 'Arial', 'sans-serif";
	if (!isset($secondaryfont[1])) $secondaryfont[1] = "";
		
	if ($type != "without"){
		
		$ptitleaux = $bcaux = "";
		if ($originalalign == "titlesleftcrumbsright" || $originalalign == "titlesrightcrumbsleft"){
    		$ptitleaux .= "max-width: 50%;";
    		$bcaux .= "max-width: 50%;";
    		if ($originalalign == "titlesleftcrumbsright"){
				$ptitleaux .= "float:left;";
				$bcaux .= "float:right;";
			} else {
				$ptitleaux .= "float:right;";
				$bcaux .= "float:left;";
			}
		}
		$bcaux .= "margin-top:".intval($breadcrumbs_margintop,10)."px;";
		switch($originalalign){
			case "left": case "titlesrightcrumbsleft":
				$bcaux .= "text-align: left;";
			break;
			case "right": case "titlesleftcrumbsright":
				$bcaux .= "text-align:right;";
			break;
			case "center": 
				$bcaux .= "text-align:center;";
			break;
		}
		
		?>
		<div class="fullwidth-container <?php if ($type == "pattern") echo "bg-pattern"; ?> <?php if ($pt_parallax) echo "parallax"; ?><?php if (($type == "image" || $type == "pattern") && get_option('deep_enable_grayscale') == 'on') echo " deep_grayscale "; ?>" <?php if ($pt_parallax) echo 'data-stellar-ratio="0.5"'; ?> 
	    	<?php
		    	$deep_output = ".fullwidth-container{";
		 		if ($height != "") $deep_output.= "height: ". $height . ";";
				if ($type == "none") $deep_output.= "background: none;"; 
				if ($type == "color") $deep_output.= "background: " . $color . ";";
				if ($type == "image") $deep_output.= "background: url(" . $image . ") no-repeat; background-size: 100% auto;";  
	 			if ($type == "pattern") $deep_output.= "background: url('" . $pattern . "') 0 0 repeat;";
				$deep_output .= "}";
				deep_set_custom_inline_css($deep_output);
				
				
	    	?> <?php if ($type == "image" && !$pt_parallax) echo ' data-background-alignment="'. esc_attr( $background_position ) .'" '; ?>>
	    	<?php
		    	if ($type == "image" && $pt_overlay){
			    	$deep_output = ".pagetitle_overlay{";
			    	echo '<div class="pagetitle_overlay"></div> '; 
			    	if ($pt_overlay_type == "color") $deep_output.= 'background-color:'.$pt_overlay_color.' !important';
			    	else $deep_output.= 'background:url('.$pt_overlay_pattern.') repeat;opacity:'.$pt_overlay_opacity.' !important;';
			    	$deep_output .= "}";
					deep_set_custom_inline_css($deep_output);
		    	}
		    	if ($type === "banner"){
			    	?> 
			    	<div class="revBanner">
				    	<?php
					    	if (substr($banner, 0, 10) === "revSlider_"){
								if (!function_exists('putRevSlider')){
									echo esc_html__('Please install the missing plugin - Revolution Slider.', 'deep');
								} else {
									putRevSlider(substr($banner, 10));
								}
							} 
							if (substr($banner, 0, 13) === "masterSlider_"){
								if (!function_exists('masterslider')){
									echo esc_html__('Please install the missing plugin - MasterSlider.', 'deep');
								} else {
									echo do_shortcode( '[masterslider alias="'.substr($banner, 13).'"]' );
								}
							}
							if (substr($banner, 0, 12) === "layerSlider_"){
								if (!function_exists('layerslider')){
									echo esc_html__('Please install the missing plugin - LayerSlider.', 'deep');
								} else {
									echo do_shortcode( '[layerslider id="'.substr($banner, 12).'"]' );
								}
							}
				    	?>
				    </div> 
				    <?php
		    	} else {
		    	?>
				<div class="container present-container <?php echo esc_attr($originalalign); if (get_option('deep_pagetitle_animations') == 'on') echo " wpb_animate_when_almost_visible wpb_fadeInUpnShort fadeInUpShort"; ?>">
					<?php
						$deep_output = ".present-container{padding: ".esc_attr($pagetitlepadding)." 25px;}";
						deep_set_custom_inline_css($deep_output);
					?>
					<div class="pageTitle">
					<?php
						$deep_output = ".present-container .pageTitle{text-align: ".esc_attr($textalign).";".esc_attr($ptitleaux)."}";
						deep_set_custom_inline_css($deep_output);
						if ($showtitle){
							?>
							<h1 class="page_title">
								<?php if (is_front_page() && is_home()) echo wp_kses(get_option('deep_blog_single_primary_title'), 'post'); else echo wp_kses(get_the_title($deep_thisPostID), 'post'); ?>
							</h1>
							<?php
							
							/* New 4.0 */	
							$deep_output = ".present-container h1.page_title{color: #$tcolor; font-size: $tsize; letter-spacing: $letterspacing; line-height: $titlelineheight; text-transform: $titletransform;";
							
							if ($margintop != "") $deep_output .= esc_attr("margin-top: ".intval($margintop,10)."px;");
							if ($originalalign === "center") $deep_output .= esc_attr("text-indent: ".($letterspacing).";");
							
							$deep_output .= "}";
							deep_set_custom_inline_css($deep_output);
						}
		    			if ($showsectitle){
			    			if (get_post_meta($post->ID, 'secondaryTitle_value', true) != "" || get_option('deep_blog_secondary_title') != ""){
						    	?>
							    <h2 class="secondaryTitle">
							    	<?php echo wp_kses(get_post_meta($post->ID, 'secondaryTitle_value', true), 'post'); ?>
							    </h2>
					    		<?php
						    	$deep_output = ".present-container .secondaryTitle{color: #$stcolor; font-size: $stsize; margin-top:{$stmargin};letter-spacing: $titlesecletterspacing; line-height: $titleseclineheight; text-transform: $titlesectransform;}";
								deep_set_custom_inline_css($deep_output);
					    	}
		    			}
		    		?>

		    		</div>
		    		<?php
		    		if ($breadcrumbs == "on"){
			    		?>
			    		<div class="deep_breadcrumbs">
							<?php 
								deep_the_breadcrumb(); 
								$deep_output = ".deep_breadcrumbs{".esc_attr($bcaux)."}";
								deep_set_custom_inline_css($deep_output);
							?>
			    		</div>
			    		<?php
					}
					?>
				</div>
		<?php }
		?>
		</div>
		<?php
	}
	
	$sidebar = deep_convert_to_class(get_post_meta($post->ID, 'sidebars_available_value', true));
	switch (get_post_meta($post->ID, 'sidebar_for_default_value', true)){
		case "none":
			?>
			<div class="master_container master_container_bgwhite">
				<section class="page_content" id="section-<?php echo esc_attr(get_the_ID()); ?>">
					
					<?php
						if (get_option('deep_layout_grid_lines_enable', 'off') == 'on'){
							?>
							<div class="body-lines"><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div></div>
							<?php
						}
					?>
					
					<div class="container">
					<?php 
						if ((function_exists('vc_is_inline') && vc_is_inline()) || is_preview() || ( function_exists('is_checkout') && is_checkout() )){
							wp_reset_postdata();
							the_content();
						} else {
							if (post_password_required()) echo get_the_password_form();
							else {
								$content_post = get_post($deep_thisPostID);
								$content = $content_post->post_content;
								
								if (strpos($content, '<!--nextpage-->') != false){
									//paged content
									$content_paged = 1;
									if (isset($wp_query) && $wp_query->query_vars['page'] > 0) $content_paged = $wp_query->query_vars['page'];
									$content_paged_index = $content_paged-1;
									$content = explode('<!--nextpage-->', $content);
									if (isset($content[$content_paged_index])) $content = $content[$content_paged_index];
									else $content = $content[0];
								}
								
								$boldway_theme_main_color = "#".get_option('deep_style_color');
								$content = str_replace( '__USE_THEME_MAIN_COLOR__', $boldway_theme_main_color, $content );
								deep_content_shortcoder($content);
								
								// Fix PHP notices on empty content
								if ( !empty( get_the_content() ) )
								
								$content = apply_filters('the_content', $content);
								
								if (function_exists('wpb_js_remove_wpautop') == true)
									echo wpb_js_remove_wpautop($content);
								else echo wp_kses($content, 'post'); 
								$shortcodes_custom_css = get_post_meta( $deep_thisPostID, '_wpb_shortcodes_custom_css', true );
								if ( isset($shortcodes_custom_css) && ! empty( $shortcodes_custom_css ) ) {
									deep_set_custom_inline_css($shortcodes_custom_css);
								}
							
								wp_reset_postdata();
								if (comments_open()){
									?>
									<div class="the_comments">
									    <?php comments_template( '', true ); ?>
								    </div>
									<?php
								}
							}
						}
						
						$args = array(
							'before'           => '<div class="navigation margin-top-0px"><div class="des-pages"><span class="pages current">' . esc_html__('Pages:', 'deep') . '</span>',
							'after'            => '</div></div>',
							'link_before'      => '<div class="postpagelinks">',
							'link_after'       => '</div>',
							'next_or_number'   => 'number',
							'nextpagelink'     => esc_html__('Next page','deep'),
							'previouspagelink' => esc_html__('Previous page','deep'),
							'pagelink'         => '%',
							'echo'             => 1
						); 
			    		wp_link_pages($args);
						?>
					</div>
				</section>
			</div>
			<?php
		break;
		case "left":
			?>
			<div class="master_container master_container_bgwhite">
				<div class="container">
					<?php
						if (!post_password_required()){
					?>
					<section class="page_content left sidebar col-xs-12 col-md-3 <?php if (get_option('deep_blog_sidebars_animations') == 'on') echo " wpb_animate_when_almost_visible wpb_fadeInUpnShort fadeInUpShort"; ?>">
						
						<?php
							if (get_option('deep_layout_grid_lines_enable', 'off') == 'on'){
								?>
								<div class="body-lines"><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div></div>
								<?php
							}
						?>
						
						<?php 
						if ($sidebar === "defaultblogsidebar") $sidebar = 'sidebar-widgets';
						if ( function_exists('dynamic_sidebar') && is_active_sidebar( $sidebar )) { 
							ob_start();
							do_shortcode(dynamic_sidebar($sidebar));
							$html = ob_get_contents();
							ob_end_clean();
							$html = wp_kses_no_null( $html, array( 'slash_zero' => 'keep' ) );
							$html = wp_kses_normalize_entities($html);
							echo wp_kses_hook($html, 'post', array());  
						} else {
							get_sidebar();
						}
						wp_reset_postdata();
						?>
					</section>
					<?php
						}
					?>
					<section class="page_content right col-xs-12 col-md-9" id="section-<?php echo esc_attr(get_the_ID()); ?>" <?php if (post_password_required()) echo ' style="border:none !important;" '; ?>>
						
						<?php
							if (get_option('deep_layout_grid_lines_enable', 'off') == 'on'){
								?>
								<div class="body-lines"><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div></div>
								<?php
							}
						?>
						
						<?php 
							if ((function_exists('vc_is_inline') && vc_is_inline()) || is_preview() || ( function_exists('is_checkout') && is_checkout() )){
								wp_reset_postdata();
								the_content();
							} else {
								if (post_password_required()) echo get_the_password_form();
								else {
								$content_post = get_post($deep_thisPostID);
								$content = $content_post->post_content;
								
									if (strpos($content, '<!--nextpage-->') != false){
										//paged content
										$content_paged = 1;
										if (isset($wp_query) && $wp_query->query_vars['page'] > 0) $content_paged = $wp_query->query_vars['page'];
										$content_paged_index = $content_paged-1;
										$content = explode('<!--nextpage-->', $content);
										if (isset($content[$content_paged_index])) $content = $content[$content_paged_index];
										else $content = $content[0];
									}
									
									$boldway_theme_main_color = "#".get_option('deep_style_color');
									$content = str_replace( '__USE_THEME_MAIN_COLOR__', $boldway_theme_main_color, $content );
									deep_content_shortcoder($content);
									
									// Fix PHP notices on empty content
									if ( !empty( get_the_content() ) )
									
									$content = apply_filters('the_content', $content);
									if (function_exists('wpb_js_remove_wpautop') == true)
										echo wpb_js_remove_wpautop($content);
									else echo wp_kses($content, 'post'); 
									$shortcodes_custom_css = get_post_meta( $deep_thisPostID, '_wpb_shortcodes_custom_css', true );
									if ( isset($shortcodes_custom_css) && ! empty( $shortcodes_custom_css ) ) {
										deep_set_custom_inline_css($shortcodes_custom_css);
									}
								
									wp_reset_postdata();
									if (comments_open()){
										?>
										<div class="the_comments">
										    <?php comments_template( '', true ); ?>
									    </div>
										<?php
									}
								}
							}
							$args = array(
								'before'           => '<div class="navigation margin-top-0px"><div class="des-pages"><span class="pages current">' . esc_html__('Pages:', 'deep') . '</span>',
								'after'            => '</div></div>',
								'link_before'      => '<div class="postpagelinks">',
								'link_after'       => '</div>',
								'next_or_number'   => 'number',
								'nextpagelink'     => esc_html__('Next page','deep'),
								'previouspagelink' => esc_html__('Previous page','deep'),
								'pagelink'         => '%',
								'echo'             => 1
							); 
				    		wp_link_pages($args);
						?>
					</section>
				</div>
			</div>
			<?php
		break;
		case "right":
			?>
			<div class="master_container master_container_bgwhite">
				
				<?php
					if (get_option('deep_layout_grid_lines_enable', 'off') == 'on'){
						?>
						<div class="body-lines"><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div></div>
						<?php
					}
				?>
				
				
				<div class="container">
					<section class="page_content left col-xs-12 col-md-9" id="section-<?php echo get_the_ID(); ?>" <?php if (post_password_required()) echo ' style="border:none !important;" '; ?>>
						
						
						<?php 
							if ((function_exists('vc_is_inline') && vc_is_inline()) || is_preview() || ( function_exists('is_checkout') && is_checkout() )){
								wp_reset_postdata();
								the_content();
							} else {
								if (post_password_required()) echo get_the_password_form();
								else {
								$content_post = get_post($deep_thisPostID);
								$content = $content_post->post_content;
								
									if (strpos($content, '<!--nextpage-->') != false){
										//paged content
										$content_paged = 1;
										if (isset($wp_query) && $wp_query->query_vars['page'] > 0) $content_paged = $wp_query->query_vars['page'];
										$content_paged_index = $content_paged-1;
										$content = explode('<!--nextpage-->', $content);
										if (isset($content[$content_paged_index])) $content = $content[$content_paged_index];
										else $content = $content[0];
									}
									
									$boldway_theme_main_color = "#".get_option('deep_style_color');
									$content = str_replace( '__USE_THEME_MAIN_COLOR__', $boldway_theme_main_color, $content );
									deep_content_shortcoder($content);
									
									// Fix PHP notices on empty content
									if ( !empty( get_the_content() ) )
									
									$content = apply_filters('the_content', $content);
									if (function_exists('wpb_js_remove_wpautop') == true)
										echo wpb_js_remove_wpautop($content);
									else echo wp_kses($content, 'post'); 
									$shortcodes_custom_css = get_post_meta( $deep_thisPostID, '_wpb_shortcodes_custom_css', true );
									if ( isset($shortcodes_custom_css) && ! empty( $shortcodes_custom_css ) ) {
										deep_set_custom_inline_css($shortcodes_custom_css);
									}
								
									wp_reset_postdata();
									if (comments_open()){
										?>
										<div class="the_comments">
										    <?php comments_template( '', true ); ?>
									    </div>
										<?php
									}
								}
							}
							$args = array(
								'before'           => '<div class="navigation margin-top-0px"><div class="des-pages"><span class="pages current">' . esc_html__('Pages:', 'deep') . '</span>',
								'after'            => '</div></div>',
								'link_before'      => '<div class="postpagelinks">',
								'link_after'       => '</div>',
								'next_or_number'   => 'number',
								'nextpagelink'     => esc_html__('Next page','deep'),
								'previouspagelink' => esc_html__('Previous page','deep'),
								'pagelink'         => '%',
								'echo'             => 1
							); 
				    		wp_link_pages($args);
						?>
					</section>
					
					<?php
						if (!post_password_required()){
							?>
					<section class="page_content right sidebar col-xs-12 col-md-3 <?php if (get_option('deep_blog_sidebars_animations') == 'on') echo " wpb_animate_when_almost_visible wpb_fadeInUpnShort fadeInUpShort"; ?>">
						<?php 
						if ($sidebar === "defaultblogsidebar") $sidebar = 'sidebar-widgets';
						if ( function_exists('dynamic_sidebar') && is_active_sidebar( $sidebar )) { 
							ob_start();
							do_shortcode(dynamic_sidebar($sidebar));
							$html = ob_get_contents();
							ob_end_clean();
							$html = wp_kses_no_null( $html, array( 'slash_zero' => 'keep' ) );
							$html = wp_kses_normalize_entities($html);
							echo wp_kses_hook($html, 'post', array());  
						} else {
							get_sidebar();
							}
						?>
					</section>
					<?php
						}
					?>
				</div>
			</div>
			<?php
		break;
		default:
			?>
			<div class="master_container master_container_bgwhite">
				<section class="page_content" id="section-<?php echo esc_attr(get_the_ID()); ?>">
					
					<?php
						if (get_option('deep_layout_grid_lines_enable', 'off') == 'on'){
							?>
							<div class="body-lines"><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div><div class="body-line"></div></div>
							<?php
						}
					?>
					
					<div class="container">
					<?php
						if ((function_exists('vc_is_inline') && vc_is_inline()) || is_preview() || ( function_exists('is_checkout') && is_checkout() )){
							wp_reset_postdata();
							the_content();
						} else {
							if (post_password_required()) echo get_the_password_form();
							else {
							$content_post = get_post($deep_thisPostID);
							$content = $content_post->post_content;
							
							if (strpos($content, '<!--nextpage-->') != false){
								//paged content
								$content_paged = 1;
								if (isset($wp_query) && $wp_query->query_vars['page'] > 0) $content_paged = $wp_query->query_vars['page'];
								$content_paged_index = $content_paged-1;
								$content = explode('<!--nextpage-->', $content);
								if (isset($content[$content_paged_index])) $content = $content[$content_paged_index];
								else $content = $content[0];
							}
							
							$boldway_theme_main_color = "#".get_option('deep_style_color');
							$content = str_replace( '__USE_THEME_MAIN_COLOR__', $boldway_theme_main_color, $content );
							deep_content_shortcoder($content);
							
							// Fix PHP notices on empty content
							if ( !empty( get_the_content() ) )
							
							$content = apply_filters('the_content', $content);
							if (function_exists('wpb_js_remove_wpautop') == true)
								echo wpb_js_remove_wpautop($content);
							else echo wp_kses($content, 'post'); 
							$shortcodes_custom_css = get_post_meta( $deep_thisPostID, '_wpb_shortcodes_custom_css', true );
							if ( isset($shortcodes_custom_css) && ! empty( $shortcodes_custom_css ) ) {
								deep_set_custom_inline_css($shortcodes_custom_css);
							}
						
							wp_reset_postdata();
							if (comments_open()){
								?>
								<div class="the_comments">
								    <?php comments_template( '', true ); ?>
							    </div>
								<?php
							}
						}
					}
					$args = array(
						'before'           => '<div class="navigation margin-top-0px"><div class="des-pages"><span class="pages current">' . esc_html__('Pages:', 'deep') . '</span>',
						'after'            => '</div></div>',
						'link_before'      => '<div class="postpagelinks">',
						'link_after'       => '</div>',
						'next_or_number'   => 'number',
						'nextpagelink'     => esc_html__('Next page','deep'),
						'previouspagelink' => esc_html__('Previous page','deep'),
						'pagelink'         => '%',
						'echo'             => 1
					); 
		    		wp_link_pages($args);
					?>
					</div>
				</section>
			</div>
			<?php
		break;
	}
	
	$deep_inline_script = '
		jQuery(document).ready(function(){
			"use strict";
			if (jQuery(".wp-audio-shortcode").length){
				jQuery(".wp-audio-shortcode").each(function(){
					jQuery(this).removeClass("wp-audio-shortcode").addClass("wp-audio-shortcode-ready").attr("preload","meta");
					if (typeof jQuery(this).get(0).player != "undefined") jQuery(this).get(0).player.remove();
					jQuery(this).append("<source src=\'"+jQuery(this).find("a").attr("href")+"\' />");
				});
			}
		});
	';
	wp_add_inline_script( 'deep-global', $deep_inline_script, 'after' );
	
	?>

<?php get_footer(); ?>