<?php
/**
 * Template part for displaying posts
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package yahosein
 */

?>
<?php 

global $roman_current_class  , $yahosein;
if(isset($yahosein['opt-ative-yeki-dar-miun']) && $yahosein['opt-ative-yeki-dar-miun']==1)
{
  $roman_current_class = ($roman_current_class == 'post_odd') ? 'post_even' : 'post_odd';
}else
{
  $roman_current_class ='post_odd' ;
}


?>
            <?php ob_start(); ?>
            <?php 
            $img_size = 'roman-small';
            if(is_singular())
            {
              $img_size = 'full';
            }
            the_post_thumbnail($img_size ,array('class'=>(($roman_current_class =='post_odd')?'pull-left':'pull-right').' img_book_roman img-responsive wp-post-image'));
            ?>
           <?php
           $roman_pic_wrp = ob_get_clean(); 
           $roman_pic_wrp = trim($roman_pic_wrp);
           if(empty($roman_pic_wrp) && isset($yahosein['opt-posts-default-pic']['url']))
           {
              $roman_pic_wrp = '<img src="'.$yahosein['opt-posts-default-pic']['url'].'" class="img_book_roman '.(($roman_current_class =='post_odd')?'pull-left':'pull-right').' img-responsive wp-post-image" alt="" width="250" height="300">';
           }
           ?> 
           
<article id="post-<?php the_ID(); ?>" <?php post_class($roman_current_class.' widget_wrapper widget_bkground_content_bg shadow_contects'); ?> >


    <div class="col-md-8 article_content col-sm-6 col-xs-12">
                <div class="text_onvan">
                <span class="tagged_as"> 
        <?php 
        if ( is_single() ) :
          the_title( '<h1 class="entry-title">', '</h1>' );
        else :
          the_title( '<h2 class="entry-title"><a href="' . esc_url( get_the_permalink() ) . '" rel="bookmark">', '</a></h2>' );
        endif;
         ?>
                 
                <span class="post_cats_wrapper">
        <?php 
        the_category( ' , ' );
         ?>
                 </span>
                </span></div>
                <hr class="border_bs">
                
        <div class="widget_content text_content">
             <?php ob_start(); ?>
            <?php $roman_info_wrp = ob_get_clean(); ?>


            <?php 
            // ترتیب عکس / چپ یا راست
 
                echo $roman_info_wrp;
               // echo $roman_pic_wrp;
                


             ?>


            <div class="roman_excerpt_wrp">
                <span class="short_title">خلاصه آیتم</span>
                <?php 
                if(is_single() || is_page())
                {
                    the_content();
                    ?>
                    <div class="col-md-12 tagged_wrapper">
                    <?php 
                    the_tags('برچسب ها:[ ',' , ',' ] ');
                     ?>
                    </div>
                    <?php
                }else
                {
                    the_excerpt();
                }

                 ?>

            </div>


        </div>
        <div class="clearfix"></div>        
        
    </div>  

    <div class="col-md-4 article_image col-sm-6 col-xs-12">
        <div class=" roman_pic_wrp"><?php echo $roman_pic_wrp; ?></div>
    </div>  
    <div class="widget_footer col-md-12">
        <div class="sub_footer">
            <?php 
            /**
             * ثبت بازدید
             */
            if(is_single() || is_page())
            {
                 roman_setPostViews(get_the_ID());                
            }
             ?>
            <ol class="post_info">
                <li><span class="fa fa-eye"></span>بازدید : <?php echo roman_getPostViews(get_the_ID()); ?> بار</li>
                <li><span class="fa fa-calendar"></span>تاريخ : <?php the_date(); ?></li>
                <li><span class="fa fa-share-alt"></span>به اشتراک بگذارید:<span class="roman_socials">
                  <a target="_blank" title="شبکه ی اجتماعی facebook" href="http://www.facebook.com/sharer.php?u=<?php echo urlencode(get_the_permalink()); ?>"><i class="fa  fa-facebook"></i></a>
                  <a target="_blank" title="شبکه ی اجتماعی send-o" href="https://telegram.me/share/url?url=<?php echo urlencode(get_the_permalink()); ?>&text=<?php echo urlencode(get_the_title()); ?>"><i class="fa fa-send-o"></i></a>
                  <a target="_blank" title="شبکه ی اجتماعی google-plus" href="http://plus.google.com/share?url=<?php echo urlencode(get_the_permalink()); ?>"><i class="fa fa-google-plus"></i></a>
                  <?php 
                  if(!(is_page() || is_single())){
                   ?>
                   </span>
                </li>
                <li>
                    <a href="<?php the_permalink(); ?>" class="btn btn-default edameh_btn hover_btn">ادامه</a>
                </li>
                <?php } ?>
            </ol>
        </div>
    </div>
    <?php
    

?>
</article>
