<?php
/*
  Template Name: Blog Alternate
 */

get_header();

//posts query

 if(is_front_page()) {
				 $paged = (get_query_var('page')) ? get_query_var('page') : 1; ;
				 }
		else {
				$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
				
				}
query_posts(array(
	
    'post_type' => 'post',
    'paged' => $paged
));

$excerpt_symbols_count = ThemeMakersThemeModel::get_option('excerpt_symbols_count');
if (!$excerpt_symbols_count) {
    $excerpt_symbols_count = 140;
}
$show_full_content = ThemeMakersThemeModel::get_option('show_full_content');
?>

<div class="title-caption-large">
	<h3><?php the_title(); ?></h3>
</div>

<section id="page">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
            <article class="post-item clearfix">

                <?php
                $terms = wp_get_post_terms($post->ID, 'cons');
                $featured_image = THEMEMAKERS_THEME_URI . '/images/no-image.jpg';
                $permalink = get_permalink($post->ID);
                $featured_image_width = 159;
                $featured_image_height = 100;
                if (has_post_thumbnail($post->ID)) {
                    $featured_image = ThemeMakersHelper::get_post_featured_image($post->ID, 'single_thumb');
                }
                ?>

                <section class="post-thumb">
                    <a href="<?php echo $permalink ?>"><img src="<?php echo $featured_image ?>" width="<?php echo $featured_image_width ?>" height="<?php echo $featured_image_height ?>" alt="<?php echo $post->post_title ?>" /></a>
                </section><!--/ .post-thumb-->

                <section class="post-entry">
                    <div class="post-date"><?php echo get_the_date() ?></div><!--/ .post-date-->
                    <div class="post-title">
                        <h5><a href="<?php the_permalink() ?>"><?php echo $post->post_title ?></a></h5>
                    </div><!--/ .post-title-->
                    <div class="description">
                        <?php if ($show_full_content) : ?>
                            <?php the_content(); ?>
                        <?php else: ?>

                            <?php
                            if ($excerpt_symbols_count) {
                                echo substr(get_the_excerpt(), 0, $excerpt_symbols_count) . " ...";
                            } else {
                                the_excerpt();
                            }
                            ?>
                        <?php endif; ?>
                    </div><!--/ .description-->
                    <div class="platform-teaser">
                                        <?php if (!empty($terms)): ?>
                                            <?php foreach ($terms as $term) : ?>
                                                <?php $cons_color = get_taxonomy_term_type('cons', $term->term_id); ?>
                                                <a style="background-color: <?php echo $cons_color ?>" class="game_console" href="<?php bloginfo('url') ?>/?cons=<?php echo $term->slug ?>"><?php echo $term->name ?></a>
                                            <?php endforeach; ?>
                                        <?php endif; ?>
                                    </div><!--/ .platform-teaser-->
                    <?php echo Thememakers_Entity_Rating::draw_rating($post->ID) ?>
                                    <?php if (!$_REQUEST['disable_blog_comments']): ?>
                    <div class="comments-icon"><a href="<?php the_permalink(); ?>#comments"><?php comments_number('0', '1', '%'); ?> <?php _e('comments', THEMEMAKERS_THEME_FOLDER_NAME); ?></a></div><!--/ comments-icon-->
                    <?php endif; ?>
                </section><!--/ .post-entry-->

            </article><!--/ .post-item-->

        <?php endwhile; ?>
    <?php endif; ?>

    <!-- ************ - BEGIN Page navigation - ************** -->	
    <div class="pagenavi">
        <?php  ThemeMakersHelper::pagenavi();
				wp_reset_query();
        ?>
    </div><!--/ pagenavi -->
	
	
    <!-- ************ - END Page navigation - ************** -->

</section>

<?php get_footer(); ?>