<?php get_header(); ?>
<?php if(get_option('tigu_homepage-news-ticker') == 'true' && get_option('tigu_newsticker_home') == 'true'): ?>
<div class="newstickers" style="height:36px;"><?php jnewsticker_display( get_option('tigu_ticker_choosed_id') ) ?></div>
<?php endif; ?>
<!-- START MAIN AREA-->
    <div id="main">
<?php $fake_loop = new WP_Query('showposts=4'); while($fake_loop->have_posts()): $fake_loop->the_post(); ?>
<?php endwhile; ?>

<?php if(get_option('tigu_featured_slider') == 'true'): ?>
<?php require_once( trailingslashit( get_template_directory() ). '/includes/sliders/sliders.php' ); ?>
<?php endif; ?>

<!-- START HOMEPAGE AREA -->
<?php if(get_option('tigu_homepage_style') == 'magazine'): ?>
<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Homepage - Magazine Layout')): ?>
 <div class="grids_box_sidebar"><div class="widget-title"><h1>
<?php if( get_option('tigu_template_type', 'WordPres Default') == 'WordPres Default') : ?>
<?php _e('Recent Posts', 'Gameleon'); ?>
<?php else: ?>
<?php _e('Recent Games', 'Gameleon'); ?>
<?php endif; ?>
</h1></div></div>
     <div class="block archive">
    <div class="block-rich">
<?php
$recent_posts = new WP_Query(array(
'showposts' => 5,
));
?>
<?php
$big_count = round(4 / 4);
if(!$big_count) { $big_count = 1; }
?>
<?php $counter = 1; while($recent_posts->have_posts()): $recent_posts->the_post(); ?>
<?php
if(has_post_format('video') || has_post_format('audio') || has_post_format('gallery')) {
$icon = '<span class="' . get_post_format($post->ID) . '-icon"></span>';
} else {
$icon = '';
}
?>
<?php if($counter <= $big_count): ?>
    <div class="high-grid">
<?php if(has_post_thumbnail() || is_myarcade_game() ): ?>
<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'blog-style-image'); ?>
<?php if ( empty($image[0]) ) $image[0] = myarcade_featured_image(); ?>
    <div class="grid-image"><a class=<?php if( get_option('tigu_template_type', 'WordPres Default') == 'WordPres Default') : ?>"hover_play_small-wp"<?php else: ?>"hover_play_small"<?php endif; ?> href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'>
<img src="<?php echo $image[0]; ?>" width="174" height="100" alt="<?php the_title(); ?>" />
</a>
<?php echo $icon; ?>
    </div>
<?php else: ?>
  <div class="grid-image"><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'>
<img src="<?php echo get_template_directory_uri(); ?>/images/thumbnail.png" width="174" height="100" alt="<?php the_title(); ?>" />
</a>
<?php echo $icon; ?>
  </div>
<?php endif; ?>
    <h2><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><?php the_title(); ?></a></h2>
 
 <p><?php echo get_excerpt(200); ?></p>
	<?php paginate_links();
	$args="";
	wp_link_pages( $args );
    ?>
    </div>
<?php else: ?>
    <div class="high-grid">
<?php if(has_post_thumbnail() || is_myarcade_game() ): ?>
<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'blog-style-image'); ?>
<?php if ( empty($image[0]) ) $image[0] = myarcade_featured_image(); ?>
      <div class="grid-image"><a class=<?php if( get_option('tigu_template_type', 'WordPres Default') == 'WordPres Default') : ?>"hover_play_small-wp"<?php else: ?>"hover_play_small"<?php endif; ?> href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'>
<img src="<?php echo $image[0]; ?>" width="174" height="100" alt="<?php the_title(); ?>" />
</a>
<?php echo $icon; ?>
    </div>
<?php else: ?>
    <div class="grid-image"><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'>
<img src="<?php echo get_template_directory_uri(); ?>/images/thumbnail.png" width="174" height="100" alt="<?php the_title(); ?>" />
</a>
<?php echo $icon; ?>
    </div>
<?php endif; ?>
    <h2><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><?php the_title(); ?></a></h2>
<p><?php echo get_excerpt(200); ?></p>
    </div>
<?php endif; ?>
<?php $counter++; endwhile; ?>
    </div></div>
<?php endif; ?>
<?php endif; ?>

<?php if(get_option('tigu_homepage_style', 'blog') == 'blog'): ?>
<div class="grids_box_sidebar">
<div class="widget-title">
<h1>

<?php if( get_option('tigu_template_type', 'WordPres Default') == 'WordPres Default') : ?>
<?php _e('Recent Posts', 'Gameleon'); ?>
<?php else: ?>
<?php _e('Recent Games', 'Gameleon'); ?>
<?php endif; ?>

</h1>
</div>
</div>
    <div class="block archive">
    <div class="block-rich">
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
<?php $blog = new WP_Query('showposts='.$posts_per_page.'&paged='.$paged); ?>

<?php
    $posts_per_page = get_option('tigu_homeblog_post_number');
    $blog->query('showposts='.$posts_per_page.'&paged='.$paged);
?>

<?php if ($blog->have_posts()) : while ($blog->have_posts()) : $blog->the_post(); ?>
    <div id="post-<?php the_ID(); ?>" <?php post_class('high-grid'); ?>>
<?php
    if(has_post_format('video') || has_post_format('audio') || has_post_format('gallery')) {
    $icon = '<span class="' . get_post_format($post->ID) . '-icon"></span>';
} else {
$icon = '';
}
?>
<?php if(has_post_thumbnail() || is_myarcade_game()): ?>
<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'blog-style-image'); ?>
<?php if ( empty($image[0]) ) $image[0] = myarcade_featured_image(); ?>
<div class="grid-image"><a class=<?php if( get_option('tigu_template_type', 'WordPres Default') == 'WordPres Default') : ?>"hover_play_small-wp"<?php else: ?>"hover_play_small"<?php endif; ?> href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'>
<img src="<?php echo $image[0]; ?>" width="174" height="100" alt="<?php the_title(); ?>" />
</a><?php echo $icon; ?></div>
<?php else: ?>
<div class="grid-image"><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'>
<img src="<?php echo get_template_directory_uri(); ?>/images/thumbnail.png" width="174" height="100" alt="<?php the_title(); ?>" />
</a><?php echo $icon; ?></div>
<?php endif; ?>

  <h2><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><?php the_title(); ?></a></h2>
<div class="somepadd block-metas">
<?php if(get_option('tigu_postdatetime_blog-layout', 'true') == 'true'): ?>
<span class="postdatetime-wp">
<?php the_time('Y-m-d') ?>
</span>
<?php endif; ?>

<?php if(get_option('tigu_mostplayed-blog-layout', 'true') == 'true'): ?>
<?php if( get_option('tigu_template_type', 'WordPres Default') == 'WordPres Default') : ?>
<span class="postviews-wp" title="<?php _e('Views', 'Gameleon'); ?>: <?php echo getMostPlayed(get_the_ID()); ?> "><?php _e('Views', 'Gameleon'); ?>: <?php echo getMostPlayed(get_the_ID()); ?></span>
<?php else: ?>
<span class="clubs" title="<?php _e('Played', 'Gameleon'); ?>: <?php echo getMostPlayed(get_the_ID()); ?> "><?php echo getMostPlayed(get_the_ID()); ?> <?php _e('plays', 'Gameleon'); ?></span>
<?php endif; ?>
<?php endif; ?>

<?php if(get_option('tigu_likes-blog-layout', 'true') == 'true'): ?>
<span class="minilikes">
<?php _e('Likes', 'Gameleon'); ?>: <?php echo $wp_superlike->show_likes($post->ID);?>
</span>
<?php endif; ?>

<?php if(get_option('tigu_comments-blog-layout', 'false') == 'true'): ?>
<?php $comment_count = get_comment_count($post->ID); ?>
<?php if ($comment_count['approved'] > 0) : ?>
<span class="heading-comments-exist">
<?php if( get_option('tigu_comments_type', 'WordPress') == 'WordPress') : ?>
<?php comments_popup_link('0','1','%'); ?>
<?php else: ?>
<fb:comments-count href="<?php echo get_permalink($post->ID); ?>"></fb:comments-count>
<?php endif; ?>
</span>
<?php else: ?>
<span class="heading-comments">
<?php if( get_option('tigu_comments_type', 'WordPress') == 'WordPress') : ?>
<?php comments_popup_link('0','1','%'); ?>
<?php else: ?>
<fb:comments-count href="<?php echo get_permalink($post->ID); ?>"></fb:comments-count>
<?php endif; ?>
</span>
<?php endif; ?>
<?php endif; ?>

</div>

     <p><?php echo get_excerpt(get_option('tigu_blog_homepage_excerpt', '270')); ?></p>
    </div>

<?php endwhile; endif; ?>

    </div>

    </div>
    <div style='padding-top: 20px;'>
<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Homepage - Blog Layout')): ?>
<?php endif; ?>
    </div>
<?php endif; ?>
<!-- END HOMEPAGE AREA -->
<?php if(get_option('tigu_pagination', 'false') == 'true' && get_option('tigu_homepage_style', 'blog') == 'blog'): ?>
<?php kriesi_pagination($pages = '', $range = 2); ?>
<?php endif; ?>
    </div>
<!-- END MAIN AREA-->
<?php get_sidebar(); ?>
<?php get_footer(); ?>