<?php 
/* number of sidebars */
$meta = get_post_meta(get_queried_object_id()); 
$num_of_sidebars = 0;
$left_sidebar = 0;
if (isset($meta['sbg_selected_sidebar'])) {
    $left_sidebar = $meta['sbg_selected_sidebar'];
    if($left_sidebar[0] != "0") {
        $num_of_sidebars++;   
    }
}
$right_sidebar = 0;
if (isset($meta['sbg_selected_sidebar_replacement'])) {
    $right_sidebar = $meta['sbg_selected_sidebar_replacement'];
    if($right_sidebar[0] != "0") {
        $num_of_sidebars++;   
    }
} 
if($num_of_sidebars=="0") {
    $image_class = "blog-full";
} else {
    $image_class = "blog-one-sidebar";
} 
global $counter_blog;
/* get blog categories */ 
$post_categories = wp_get_post_categories(get_the_ID()); 
/* get the content */ 
if(get_option("rss_use_excerpt") == "0"){ 
    global $more;
    $more = 0;
    $content_text = get_the_content('');
} else { 
    global $more;
    $more = 0;
    $content_text = get_the_excerpt(); 
}
$post_class = "";
ob_start();
post_class('text-center');
$post_class = ob_get_clean();
$post_data = "<article id='post-" . get_the_ID() . "' " . $post_class . ">";
$post_data .= "<header>";
$post_data .= "<a href='".get_permalink()."'>".anps_header_media(get_the_ID(), $image_class)."</a>";
$post_data .= "<h2>".get_the_title()."</h2>";
$post_data .= "</header>";
$post_data .= "<p>".$content_text."</p>"; 
$post_data .= "<div class='post-meta'>";
$post_data .= "<ul>";
$post_data .= "<li><i class='fa fa-user'></i>".__("posted by", ANPS_TEMPLATE_LANG)." <a href='".get_author_posts_url(get_the_author_meta('ID'))."' class='author'>".get_the_author()."</a></li>";
$post_data .= "<li><i class='fa fa-calendar-o'></i>".get_the_date("jS M Y")."</li>";
$post_data .= "<li><i class='fa fa-comment-o'></i><a href='".get_permalink()."#comments'>".__("comments", ANPS_TEMPLATE_LANG)." [ ".get_comments_number()." ]</a></li>";
$post_data .= "<li><i class='fa fa-folder-o'></i>";
$first_item = false;
foreach($post_categories as $c) {
    $cat = get_category($c); 
    if($first_item) {
        $post_data .= " / ";
    }
    $first_item = true;
    $post_data .= "<a href='".get_category_link($c)."'>".$cat->name."</a>";
} 
$post_data .= "</li>";
$post_data .= "</ul>";
$post_data .= "</div>";
$post_data .= '<a class="btn btn-md" href="'.get_permalink().'">'.__("more", ANPS_TEMPLATE_LANG).'</a>';
$post_data .= "</article>"; 
echo $post_data;