
<?php get_header(); ?>

<div id="main_content"> 
<div class="inner">

<?php
$thumb_id = get_post_thumbnail_id();
$thumb_url = wp_get_attachment_image_src($thumb_id,'post-thumbnails', true);
?>
<?php $post_layout = get_post_meta($post->ID, "r_post_layout", $single = true);  ?>
<?php $post_thumb_var = get_post_meta($post->ID, "r_post_thumb_var", $single = true); ?>

<?php if($post_thumb_var == 'Full width') { ?>

<?php $image_full = aq_resize( $thumb_url[0], 1140, 'auto', false); ?>
<div class="big_image_cover">

<img src="<?php echo $image_full ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />
<div class="photo_bg_shadow"></div>

<div class="photo_bg_inner">
<?php if (get_option('op_single_meta_line') == 'on') { ?>	
	<div class="post_meta_line">
		<div class="post_time"><?php the_time('d F, Y'); ?></div> 
		<div class="post_cats"><?php
					$categories_string = '';
					foreach((get_the_category()) as $category) {
                    $category_term = $category->category_nicename . '';
					$categories_string .= '<a class="custom_cat_class '. $category_term .'" href="'.get_category_link( $category->term_id ).'" title="' . esc_attr( sprintf( __( "%s", 'my-text-domain' ), $category->name ) ) . '">'.$category->cat_name.'</a>';
	                } 
					$categories_string = trim($categories_string);
					echo $categories_string;
					?>
			</div>  
		<div class="post_views"><?php setPostViews(get_the_ID()); echo getPostViews(get_the_ID()); ?></div>
	</div> 
<?php } ?>
    <div class="clear"></div>
	<h1><?php the_title(); ?></h1> 
</div>

</div>

<?php } ?>

<?php if($post_thumb_var == 'Full width - Parallax') { ?>

<?php $image_full = aq_resize( $thumb_url[0], 1140, 'auto', false); ?>
<?php wp_enqueue_script('stellar', BASE_URL . 'js/jquery.stellar.js', false, '', true); ?>
<div class="single_photo"
style=" background-image: url(<?php echo $image_full ?>);"
data-stellar-background-ratio="0.5" >
<div class="photo_bg_shadow">
 
    <div class="photo_bg_inner">
 	<?php if (get_option('op_single_meta_line') == 'on') { ?>	
	<div class="post_meta_line">
		<div class="post_time"><?php the_time('d F, Y'); ?></div> 
		<div class="post_cats"><?php
					$categories_string = '';
					foreach((get_the_category()) as $category) {
                    $category_term = $category->category_nicename . '';
					$categories_string .= '<a class="custom_cat_class '. $category_term .'" href="'.get_category_link( $category->term_id ).'" title="' . esc_attr( sprintf( __( "%s", 'my-text-domain' ), $category->name ) ) . '">'.$category->cat_name.'</a>';
	                } 
					$categories_string = trim($categories_string);
					echo $categories_string;
					?>
		</div>  
		<div class="post_views"><?php setPostViews(get_the_ID()); echo getPostViews(get_the_ID()); ?></div>
	</div> 
	<?php } ?>
    <div class="clear"></div>
	<h1><?php the_title(); ?></h1> 
    </div>
	
</div>
</div>

<?php } ?>

<?php if($post_layout == 'Small Sidebar - Left') { ?>
<div class="index_small_left">
<?php get_sidebar('small'); ?>
</div>
<?php } ?>	

<div id="single_content" class="<?php if($post_layout == 'With Small Sidebar' || $post_layout == 'Small Sidebar - Left') { ?>_2_sidebar<?php } ?>"> 	

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
	
    <div class="single_post" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
	
	<?php if($post_thumb_var == '' || $post_thumb_var == 'Standard') { ?>
	
	   <?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'post-thumbnails', false, '' ); $thumbnailSrc = $src[0]; ?>	

	   <?php if(has_post_thumbnail()) { ?>

	    <?php $post_thumbnail = get_post_meta($post->ID, "r_post_thumbnail", $single = true);
	    if($post_thumbnail !== 'on') { ?>
		
	    <div class="single_thumbnail">
		<a href="<?php echo $thumbnailSrc ?>" title="<?php the_title(); ?>" rel="prettyphoto">
	    <?php $image = aq_resize( $thumbnailSrc, 830, 'auto', false); ?>
        <img src="<?php echo $image ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>"/>
	    </a>
		</div>
	    <?php } ?>
	   
	    <?php } else {} ?>
		
	<?php } ?>
	
		<?php $post_video = get_post_meta($post->ID, "r_post_video", $single = true);
	   if($post_video !== '') { ?>
	
	<?php 
        $youtube = get_post_meta($post->ID, 'r_youtube', true);
        $vimeo = get_post_meta($post->ID, 'r_vimeo', true);
    ?>

		<?php if($youtube) { ?>
		<div class="video-container">
		    <iframe src="//www.youtube.com/embed/<?php echo $youtube; ?>" frameborder="0" allowfullscreen></iframe>
		</div>
		<?php } ?>
		
        <?php if($vimeo) { ?>
		<div class="video-container">
		    <iframe src="//player.vimeo.com/video/<?php echo $vimeo; ?>" ></iframe>
		</div> 
		<?php } ?>

	<div class="clear"></div>

	<?php } else { } ?>
	
	<?php $post_slider = get_post_meta($post->ID, "r_post_slider", $single = true);
	   if($post_slider !== '') { ?>
	
	<?php wp_enqueue_script('flexslider', BASE_URL . 'js/jquery.flexslider-min.js', false, '', true); ?>

<script type="text/javascript">   
jQuery(document).ready(function($){  	
$('.slider_format').flexslider({
animation: "slide",
slideshow: true,
slideshowSpeed: 5000,         
animationDuration: 700,  
directionNav: true,
controlNav: false
});
});		
</script>	
	
	
	 <div class="slider_format">
	    <ul class="slides">
	    <?php 
        $slider_image_1 = get_post_meta($post->ID, 'r_slider_image_1', true);
		$slider_image_2 = get_post_meta($post->ID, 'r_slider_image_2', true);
		$slider_image_3 = get_post_meta($post->ID, 'r_slider_image_3', true);
		$slider_image_4 = get_post_meta($post->ID, 'r_slider_image_4', true);
        ?>
		<?php  if($slider_image_1 !== '') { ?>
	    <li>
	    <?php $image = aq_resize( $slider_image_1, 830, 400, true ); ?>
        <img src="<?php echo $image ?>"/>
	    </li>	
        <?php } ?>
	    <?php  if($slider_image_2 !== '') { ?>
		<li>
	    <?php $image = aq_resize( $slider_image_2, 830, 400, true ); ?>
        <img src="<?php echo $image ?>"/>
	    </li>	
        <?php } ?>
	    <?php  if($slider_image_3 !== '') { ?>
		<li>
	    <?php $image = aq_resize( $slider_image_3, 830, 400, true ); ?>
        <img src="<?php echo $image ?>"/>
	    </li>
        <?php } ?>
	    <?php  if($slider_image_4 !== '') { ?>
		<li>
	    <?php $image = aq_resize( $slider_image_4, 830, 400, true ); ?>
        <img src="<?php echo $image ?>"/>
	    </li>
        <?php } ?>
        </ul>
    </div>
	<div class="clear"></div>
	<?php } else { } ?>
	
	<?php if (get_option('op_crumbs_single') == 'on') { ?>
<div id="content_bread_panel">	
<?php if (function_exists('wp_breadcrumbs')) wp_breadcrumbs(); ?>
</div>
<div class="clear"></div>
<?php } ?>
	
	<?php if($post_thumb_var == '' || $post_thumb_var == 'Standard') { ?>
	
	<div class="single_title">	  
	   <h1><?php the_title(); ?></h1> 
    </div>
	
	<div class="clear"></div>

	<?php if (get_option('op_single_meta_line') == 'on') { ?>	
	<div class="post_meta_line">
		<div class="post_time"><?php the_time('d F, Y'); ?></div> 
		<div class="post_cats"><?php
					$categories_string = '';
					foreach((get_the_category()) as $category) {
                    $category_term = $category->category_nicename . '';
					$categories_string .= '<a class="custom_cat_class '. $category_term .'" href="'.get_category_link( $category->term_id ).'" title="' . esc_attr( sprintf( __( "%s", 'my-text-domain' ), $category->name ) ) . '">'.$category->cat_name.'</a>';
	                } 
					$categories_string = trim($categories_string);
					echo $categories_string;
					?>
		</div>  
		<div class="post_views"><?php setPostViews(get_the_ID()); echo getPostViews(get_the_ID()); ?></div>
	</div> 
	<?php } ?>
	
	<?php } ?>
	
    <div class="clear"></div>
	
    <div class="single_text">
	    <?php the_content(''); ?>
		<?php custom_wp_link_pages(); ?>	
    </div>
	<div class="clear"></div>
	
	<div class="single_author"><?php echo $op_signle_author ?> <?php the_author_link(); ?></div> 
	<div class="clear"></div>
	
	<?php if (get_option('op_tags') == 'on') { ?>
	
	<div class="tags_title_box"><?php echo $op_tags_title ?></h3></div>
	
	<?php if (get_option('op_tags_variant') == 'All tags') { ?>

	<ul id="post_tags">
    <?php
	$args = array (
		'echo' => 0,
		'show_count' => 1,
		'title_li' => '',
		'depth' => 1
	);
	$variable = wp_list_categories($args);
	$variable = str_replace ( "(" , "<span>", $variable );
	$variable = str_replace ( ")" , "</span>", $variable );
	echo $variable;
    ?>
    </ul>
	
    <script type="text/javascript">
	jQuery(document).ready(function($){  
	
	$("#post_tags")
	.find("span")
	.each(function(){
	$(this).animate({"width": "5px"});
	})
	.parent()
	.hover(
	function(){
	$(this).find("span").stop().animate({"width": "35px"});
	}, function() {
	$(this).find("span").stop().animate({"width": "5px"});
	});
	
	});
    </script>
	
	<?php } else { ?>
	<?php the_tags('<ul id="tags_simple"><li>','</li><li>','</li></ul>'); ?>
	<?php } ?>
	
    <?php } ?>
	
	<div class="clear"></div>
	
	
<?php if (get_option('op_nav_variant') == 'Sticky') { ?>	
	
<div class="nav_svg">
	<svg width="64" height="64" viewBox="0 0 64 64">
		<path id="arrow-left-1" d="M46.077 55.738c0.858 0.867 0.858 2.266 0 3.133s-2.243 0.867-3.101 0l-25.056-25.302c-0.858-0.867-0.858-2.269 0-3.133l25.056-25.306c0.858-0.867 2.243-0.867 3.101 0s0.858 2.266 0 3.133l-22.848 23.738 22.848 23.738z" />
	</svg>
	
	<svg width="64" height="64" viewBox="0 0 64 64">
		<path id="arrow-right-1" d="M17.919 55.738c-0.858 0.867-0.858 2.266 0 3.133s2.243 0.867 3.101 0l25.056-25.302c0.858-0.867 0.858-2.269 0-3.133l-25.056-25.306c-0.858-0.867-2.243-0.867-3.101 0s-0.858 2.266 0 3.133l22.848 23.738-22.848 23.738z" />
	</svg>
</div>
	
<div class="nav-slide">
	<div class="sticky_post sticky_prev_post">
	<span class="icon-wrap"><svg class="icon" width="32" height="32" viewBox="0 0 64 64"><use xlink:href="#arrow-left-1"></svg></span>
	
	<div class="sticky_post_content">
		<h3><?php previous_post_link(); ?></h3>
		
		<?php
        $prev_post = get_previous_post();
        if (!empty( $prev_post )): ?>
        <a href="<?php echo get_permalink( $prev_post->ID ); ?>">
	    <?php echo get_the_post_thumbnail($prev_post->ID, 'thumbnail', array(100,100)); ?>
	    </a>
        <?php endif; ?>
	</div>
	
	</div>
	
	<div class="sticky_post sticky_next_post">
	<span class="icon-wrap"><svg class="icon" width="32" height="32" viewBox="0 0 64 64"><use xlink:href="#arrow-right-1"></svg></span>
		
	<div class="sticky_post_content">
		<h3><?php next_post_link(); ?></h3>
		<?php
        $next_post = get_next_post();
        if (!empty( $next_post )): ?>
        <a href="<?php echo get_permalink( $next_post->ID ); ?>">
	    <?php echo get_the_post_thumbnail($next_post->ID, 'thumbnail', array(100,100)); ?>
	    </a>
        <?php endif; ?>
	</div>
	
	</div>
</div>
	
<?php } else { ?>	
	
	<div id="navigation_images">
	<div class="alignleft">
	<?php
    $prev_post = get_previous_post();
    if (!empty( $prev_post )): ?>
    <a href="<?php echo get_permalink( $prev_post->ID ); ?>">
	<?php echo get_the_post_thumbnail($prev_post->ID, 'thumbnail', array(90,90)); ?>
	</a>
    <?php endif; ?>
	
	<div class="prev_link_title">
	<span>- <?php echo (get_option('op_previous_article')) ?></span> </br>
    <?php previous_post_link(); ?>
    </div>
	
	</div> 
	
	<div class="alignright">
	
	<?php
    $next_post = get_next_post();
    if (!empty( $next_post )): ?>
    <a href="<?php echo get_permalink( $next_post->ID ); ?>">
	<?php echo get_the_post_thumbnail($next_post->ID, 'thumbnail', array(90,90)); ?>
	</a>
    <?php endif; ?>
	
	<div class="next_link_title">
	<span><?php echo (get_option('op_next_article')) ?> -</span></br>
	<?php next_post_link(); ?>
    </div>
	</div>

	</div> 
	
	<div class="clear"></div>
<?php } ?>
	
	
	<?php if (get_option('op_single_recent') == 'on') { ?>
	<ul id="single_recent_posts">
	
	<div class="latest_title_box"><?php echo $op_recent_posts ?></h3></div>	
	<div class="clear"></div>	
	<?php $archive_query = new WP_Query('showposts=6');  
        while ($archive_query->have_posts()) : $archive_query->the_post(); ?>  
		
        <li>  
		<?php if(has_post_thumbnail()) { ?>
		<?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'post-thumbnails', false, '' ); $thumbnailSrc = $src[0]; ?>		
		
		<?php echo $post_format_image ?> 
		
        <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
		<?php $image = aq_resize( $thumbnailSrc, 110, 70, false); ?>
        <img src="<?php echo $image ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>"/>
		</a>
		
        <?php } else {} ?>
		
        <a class="recent_posts_title" href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>  
       
	    <div class="post_meta_line">
		    <div class="post_time"><?php the_time('F j'); ?></div> 
			<div class="post_cats"><?php
					$categories_string = '';
					foreach((get_the_category()) as $category) {
                    $category_term = $category->category_nicename . '';
					$categories_string .= '<a class="custom_cat_class '. $category_term .'" href="'.get_category_link( $category->term_id ).'" title="' . esc_attr( sprintf( __( "%s", 'my-text-domain' ), $category->name ) ) . '">'.$category->cat_name.'</a>';
	                } 
					$categories_string = trim($categories_string);
					echo $categories_string;
					?>
			</div> 
		</div> 
	   
	   </li>  
    <?php endwhile; ?>  
    </ul>
	<?php } ?>
	
	
    <?php if (get_option('op_similar') == 'on') { ?>
	<div id="similar-post" class="mosaicflow" data-item-selector=".similar_posts" data-min-item-width="220"> 
 
	    <?php
        $tags = wp_get_post_tags($post->ID);
        if ($tags) {
        $tag_ids = array();
        foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;

        $args=array(
        'tag__in' => $tag_ids,
        'post__not_in' => array($post->ID),
        'showposts'=>3,
        'caller_get_posts'=>1
        );
        $my_query = new wp_query($args);
        if( $my_query->have_posts() ) {
        echo '<div class="sim_title_box"><h3>'. $op_more_news .' </h3></div><div class="clear"></div><ul>';
        while ($my_query->have_posts()) {
        $my_query->the_post();
        ?>
		
		<li class="similar_posts">
		
		    <?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'post-thumbnails', false, '' ); $thumbnailSrc = $src[0]; ?>	 
            <?php if(has_post_thumbnail()) { ?>	
			
			<div class="similar_posts_images_box">
            <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" >
			<?php $image = aq_resize( $thumbnailSrc, 460, 280, true ); ?>
            <img src="<?php echo $image ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>"/>					
            </a>
			</div>
			
			
            <?php } else { } ?>	
		
			<h1><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" ><?php the_title(); ?></a></h1>

			<span class="post_cats">
			<?php
					$categories_string = '';
					foreach((get_the_category()) as $category) {
                    $category_term = $category->category_nicename . '';
					$categories_string .= '<a class="custom_cat_class '. $category_term .'" href="'.get_category_link( $category->term_id ).'" title="' . esc_attr( sprintf( __( "%s", 'my-text-domain' ), $category->name ) ) . '">'.$category->cat_name.'</a>';
	                } 
					$categories_string = trim($categories_string);
					echo $categories_string;
			?>
			</span>
			
	    </li>
		
        <?php } echo '</ul>'; } } ?>
        <?php wp_reset_query(); ?>
		
    </div>	 
	<?php } ?>	 
	
	<div class="clear"></div>

	<?php posts_nav_link(' &#183; ', 'previous page', 'next page'); ?>
	
	<?php if (get_option('op_single_comments') == 'on') { ?>
	
	<?php if (get_option('op_comments_variant') == 'Simple comments') { 
	comments_template('', true); } else { ?>
	
	<?php $discus = get_option('op_discus'); ?>
	
	<div id="disqus_thread"></div>
    <script type="text/javascript">
        /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
        var disqus_shortname = '<?php echo $discus ?>'; // required: replace example with your forum shortname

        /* * * DON'T EDIT BELOW THIS LINE * * */
        (function() {
            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
            dsq.src = 'http://'+disqus_shortname+'.disqus.com/embed.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();
    </script>
    <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
	<?php } ?>
	
	<?php } ?>	
	
	<?php endwhile; ?>
	<?php else : ?>
	
	<?php endif; ?>	 

</div>

</div>


<?php if($post_layout == 'With Small Sidebar') { ?>
<div class="index_2_sidebar">
<?php get_sidebar('small'); ?>
</div>
<?php } ?>		
	
<?php get_sidebar('right'); ?>	
	
</div>
</div>

<div class="clear"></div>
<link rel="canonical" href="http://www.20script.ir" />
<?php get_footer(); ?>

	
	