<?php get_header(); ?>
    <div id="promo1" class="blogsinglepage">
        <div  id="post-<?php the_ID(); ?>" class="page-single">


<div class="container">            
<div class="row">

    <article class="col-md-12 blog-block">
           
    <?php while(have_posts()) : the_post();




            $next_format = get_post_format();
            switch($next_format)
            {
              case 'audio':
               $pimg = get_stylesheet_directory_uri().'/images/postformat/audio.png';
              break;
              case 'video':
               $pimg = get_stylesheet_directory_uri().'/images/postformat/video.png';
              break;  
              case 'gallery':
               $pimg = get_stylesheet_directory_uri().'/images/postformat/gallery.png';
              break;  
              case 'link':
               $pimg = get_stylesheet_directory_uri().'/images/postformat/link.png';
              break;   
              case 'quote':
               $pimg = get_stylesheet_directory_uri().'/images/postformat/quote.png';
              break; 
              default:
               $pimg = get_stylesheet_directory_uri().'/images/postformat/regular.png';
              break;                                                      
            }

 ?>

                <section class="">
                  <h2 class="blog-caps">
                    <a href="<?php the_permalink(); ?>"><?php the_title(); ?> </a>
                  </h2>
                  <div class="postformat"><img src="<?php echo $pimg; ?>" alt="post" title="Format"/></div>
                  <div class="blog-stats">
                 <?php if(is_sticky()):
                   echo '<span class="sticky">'; 
                    _e('STICKY','sagalang'); 
                   echo '&nbsp;</span>'; endif; ?>                  
                    <?php _e('By','sagalang'); ?> <a href="<?php echo get_author_posts_url(get_the_author_meta( 'ID' )); ?>"><span class="stat_hl"><?php the_author(); ?></span></a> 
                    <?php _e('On','sagalang'); ?> <span class="stat_hl">
                    <a href="<?php echo get_day_link(get_the_time('Y'), get_the_time('m'),get_the_time('d')); ?>">
                    <?php echo get_the_date('F jS'); ?>
                    </a>
                    </span> 
                    In <span class="stat_hl"><?php 
                      $wpcats = get_the_category();
                      if($wpcats):
                        $cats = array();

                              foreach ($wpcats as $c) {
                              //$cats[] = get_cat_name( $c );
                              $cats[] = '<a href="'.get_category_link($c->term_id).'">' . $c->cat_name.'</a>';
                              }
                        $lister = implode(",", $cats);
                        echo $lister;
                      endif;
                   ?></span> 

                  </div>                  


<div class="blog-thumb-single">
<?php
            $next_format = get_post_format();
            switch($next_format)
            {
              case 'audio':
               $next_audio = get_post_meta($post->ID,'next_post_soundcloud',true);
               if($next_audio !=""):
                echo '<div class="masonary-blog-video">
                   '.$next_audio.'
                    </div>';
               else:
                  if(has_post_thumbnail()): 
                   the_post_thumbnail( 'full', array(
                    'class' => "img-responsive",
                    'alt' => get_the_title(),
                  )); 
                  endif;
               endif; 
               
              break;
              case 'video':
               $next_video = get_post_meta($post->ID,'next_post_videoembed',true);
               if($next_video !=""):
                echo '<div class="masonary-blog-video">
                   '.$next_video.'
                    </div>';
               else:
                  if(has_post_thumbnail()): 
                   the_post_thumbnail( 'full', array(
                    'class' => "img-responsive",
                    'alt' => get_the_title(),
                  )); 
                  endif;
               endif; 
              break;  

              case 'gallery':
              $next_sliderimages = get_post_meta($post->ID,'next_post_blogslider',false);
              $slides = count($next_sliderimages);
                if($slides > 0):
                echo '<div class="sliderpost">';

                 for($i=0;$i<$slides;$i++)
                 {

                    $imurl = wp_get_attachment_image_src($next_sliderimages[$i],'full');
                    echo '<img src="'.$imurl[0].'" alt="" />';
                 }
                  echo  '</div>';
                else:
                  if(has_post_thumbnail()): 
                   the_post_thumbnail( 'full', array(
                    'class' => "img-responsive",
                    'alt' => get_the_title(),
                  )); 
                  endif;
                endif;  
              break;  

              case 'link':
                 $next_link = get_post_meta($post->ID,'next_post_linkpost',true);
                 if($next_link !=''):
                 echo '<div class="blog-quote linkpost">';
                 echo '<a href="'.$next_link.'" target="_blank">'.$next_link.'</a>';                 
                 echo '</div>';
                 endif;
              break;  

              case 'quote':
                 $next_quote = get_post_meta($post->ID,'next_post_quote',true);
                 if($next_quote !=''):
                 echo '<div class="blog-quote">';
                 echo '"'.$next_quote.'"';                 
                 echo '</div>';
                 endif;
              break; 

              default:
                 echo '<div class="sliderpost">';
                  if(has_post_thumbnail()): 
                   the_post_thumbnail( 'full', array(
                    'class' => "",
                    'alt' => get_the_title(),
                  )); 
                  endif;
                 echo '</div>'; 
              break;                                                      
            }
?>

</div>
<div class="row">
        <article class="col-md-12 blog-content add-top-20" >
           <?php the_content(); ?>     
        </article> 
</div>

<section class="row">
   <article class="col-md-12" >
  <div class="blog-tags">
  <?php wp_link_pages(); ?>
  </div>  
  </article>
</section>

<section class="row">
   <article class="col-md-12" >
  <div class="blog-tags">
  <?php the_tags('<ul><li>','</li><li>','</li></ul>'); ?>
  </div>  
  </article>
</section> 

<section class="row add-top-20">
   <article class="col-md-6" >
  <div class="blog-tags">
    <?php previous_post_link('%link',"<strong>&larr;Prev</strong>");    ?>
  </div>  
  </article>
   <article class="col-md-6" >
  <div class="blog-tags text-right">
    <?php next_post_link('%link',"<strong>Next&rarr;</strong>"); ?>
  </div>  
  </article>  
</section> 



  </section>
<?php endwhile; ?>

<section class="row add-top-20">
    <article class="col-md-12" >
       <div class="comments"> <?php comments_template(); ?> </div> 
    </article>
</section> 

</article><!-- left-side : ends-->

 </div><!-- row : ends -->

      </div> 
    </div> 
</div>   
<?php 
get_footer(); ?>