<?php
	cs_slider_gallery_template_redirect();
	global $cs_node,$cs_theme_option,$cs_counter_node;
	$cs_node = new stdClass();
  	get_header();
	$cs_layout = '';
	if (have_posts()):
		while (have_posts()) : the_post();	
	$post_xml = get_post_meta($post->ID, "post", true);	
	if ( $post_xml <> "" ) {
		$cs_xmlObject = new SimpleXMLElement($post_xml);
		
		$cs_layout = "content-left col-md-9";
		$custom_height = 390;
 		
 	}else{
		$cs_layout = "content-left col-md-9";
		$custom_height = 390;
	}

			if ( $post_xml <> "" ) {
				$cs_xmlObject = new SimpleXMLElement($post_xml);
				$post_view = $cs_xmlObject->inside_post_thumb_view;
 				$post_video = $cs_xmlObject->inside_post_thumb_video;
				$post_audio = $cs_xmlObject->inside_post_thumb_audio;
				$post_slider = $cs_xmlObject->inside_post_thumb_slider;
 				$post_featured_image = $cs_xmlObject->inside_post_featured_image_as_thumbnail;
				$width = 716;
				$height = 393;
				$image_url = cs_get_post_img_src($post->ID, $width, $height);
			}
			else {
				$cs_xmlObject = new stdClass();
				$post_view = '';
 				$post_video = '';
				$post_audio = '';
				$post_slider = '';
				$post_slider_type = '';
				$image_url = '';
				$width = 0;
				$height = 0;
				$image_id = 0;
				$custom_height = 390;
				$cs_xmlObject->post_social_sharing = '';
 			}		
 			$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); 
			$image_url = $thumb['0'];
			?>
                        <!-- Need to add code below in function file to call it on all pages -->
                        <!--Left Sidebar Starts-->
                        <?php if ($cs_layout == 'content-right col-md-9'){ ?>
                            <div class="col-lg-3 col-md-3 col-sm-3"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar') ) : ?><?php endif; ?></div>
                        <?php } ?>
                        <!--Left Sidebar End-->
                        <!-- Blog Detail Start -->
                        <div class="<?php echo $cs_layout; ?> excursie single">
							<!-- Blog Start -->
 							<!-- Blog Post Start -->
                            <div class="cs-blog blog_detail">
                            <article <?php post_class(fnc_post_type($post_view ,$image_url). ' post-content'); ?>>
                              
                                        <!-- Blog Post Thumbnail Start -->
							<?php 
								/*echo '<figure class="detail_figure" style="background-image: url('.$image_url.')">';
								echo '<img src="'.$image_url.'" >';
								echo '</figure>';*/
                                     
							?>
							<span class="excursie-prezentare" >
								<span class="thumb">
									<span style="background-image: url('<?php echo $image_url; ?>');">
									</span>
								</span>
								<span class="excursie-prezentare-content">
									<span class="display-table">
										<span class="display-table-cell">
											
											<?php 
												$excursieTerm = wp_get_post_terms( get_the_ID(), 'destinatii' )[0]->name; 
											?>
											<span class="term">
												<span>
													<?php echo $excursieTerm; ?>
												</span>
											</span>
											<span class="price">
												<span>
													<?php 
														//_e('Preț: ','theme'); 
														if(get_field('exc_price')){
															if(get_field('exc_price_de_la')){
																_e('de la ','theme'); 
															}
															echo ' <span>';
															the_field('exc_price'); 
															echo '</span>';
														} 
														echo ' ';
														_e('€','theme'); 
													?>
												</span>
											</span>
										</span>
									</span>
								</span>
							</span>
							<?php /*
                             <div class="cs-blog-panel">
                                <ul class="post-options">
                                    <li><i class="fa fa-calendar"></i><time><?php echo get_the_date(); ?></time></li>
                                </ul>
                              </div>*/ ?>
                              <br/>
                              <div class="clear"></div>
                                <div class="detail_text rich_editor_text">
                                	
                             		<?php 
                                		the_content();
										
										echo do_shortcode('[contact-form-7 id="7085" title="Excursie"]');
										
										wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'WeStand' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) );
								  ?>
                                </div>
                            </article>
                            <!-- Post tags Section -->
								<?php 
								if(isset($cs_xmlObject->post_tags_show) &&  $cs_xmlObject->post_tags_show == 'on'){
                                    /* translators: used between list items, there is a space after the comma */
									$before_cat = "<div class='post-tags'><h6>".__('Tags','WeStand')."<i class='fa fa-tags'></i></h6>";
                                   // $before_cat = "<i class='fa fa-tags'></i>";
                                    $categories_list = get_the_term_list ( get_the_id(), 'post_tag', $before_cat, ' ', '</div>' );
                                    if ( $categories_list ){
                                        printf( __( '%1$s', 'WeStand'),$categories_list );
                                    } // End if categories 
								}
                                ?>
                            <!-- Post tags Section Close -->
                            <div class="share-post">
                            	<?php 
								if ($cs_xmlObject->post_social_sharing == "on"){
									cs_addthis_script_init_method();
								?>
                                <a class="addthis_button_compact btnshare" href="#"><i class="fa fa-share-square-o"></i><?php if($cs_theme_option['trans_switcher'] == "on"){ _e('Sahre','WeStand');}else{ echo $cs_theme_option['trans_share_this_post']; } ?> </a>
                                <?php
								}
								?>
                              <?php if(isset($cs_xmlObject->post_pagination_show) &&  $cs_xmlObject->post_pagination_show == 'on'){cs_next_prev_post();} ?>
                            </div>
                            <?php /*if (isset($cs_xmlObject->post_author_info_show) && $cs_xmlObject->post_author_info_show == "on"){?>
                            	<!-- About Author Section -->
                                <div class="about-author">
                                    <figure><a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>"><?php echo get_avatar(get_the_author_meta('user_email'), apply_filters('PixFill_author_bio_avatar_size', 59)); ?></a></figure>
                                    <div class="text">
                                        <h2><?php echo get_the_author(); ?></h2>
                                        <p><?php the_author_meta('description'); ?></p>
                                        <?php if(get_the_author_meta('twitter') <> ''){?><a class="follow-tweet" href="http://twitter.com/<?php the_author_meta('twitter'); ?>"><i class="fa fa-twitter"></i>@<?php the_author_meta('twitter'); ?></a><?php }?>
                                    </div>
                                </div>
                            <!-- About Author Section Close -->
                          <?php } */?>
						<?php comments_template('', true); ?>
                     <!-- Blog Post End -->
                     </div>
               	</div>
		  		<?php endwhile;   endif;?>
                <!--Content Area End-->
                <!--Right Sidebar Starts-->
                <?php if ( $cs_layout  == 'content-left col-md-9'){ ?>
                	<div class="col-lg-3 col-md-3 col-sm-3"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar') ) : ?><?php endif; ?></div>
                <?php } ?>
<!-- Columns End -->
<!--Footer-->
<?php get_footer(); ?>
