I’ve solved my task! ‘begin_roundblock’ and ‘end_roundblock’ are my functions for making blocks to games. ‘cols’ and ‘rows’ are number columns rows and rows for games.
if ($tag) {
$cols = 9;
$rows = 5;
$paged = (('paged')) ? get_query_var('paged') : 1;
$post_per_page = $cols * $rows; // -1 shows all posts
$do_not_show_stickies = 1; // 0 to show stickies
$args=array(
'post_type' => 'game',
'tag' => $tag,
'orderby' => 'date',
'order' => 'DESC',
'paged' => $paged,
'posts_per_page' => $post_per_page,
'caller_get_posts' => $do_not_show_stickies
);
$wp_query = new WP_Query($args);
begin_roundblock(urldecode($tag), 'games-pages-tag', null);
if( have_posts()) :
echo '<div class="games-list-block-content">';
$i = 0;
while (have_posts())
{
the_post();
$class="game-info";
if ($i % $cols == 0)
$class .= ' clear';
echo '<div class="'.$class.'"><a href="'.get_permalink().'">';
the_post_thumbnail(array(60, 60), array('class' => 'game-icon'));
$title = get_the_title();
if (mb_strlen($title) > 10)
$title = mb_substr($title, 0, 7).'...';
echo '<span class="game-title">'.$title.'</span></a></div>';
$i++;
} ?>
<div class="navigation clear game-info-last-row">
<span class="alignleft"><?php next_posts_link('« Older Entries') ?></span>
<span class="alignright"><?php previous_posts_link('Newer Entries »') ?></span>
</div>
</div>
<?php else: ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php get_search_form(); ?>
<?php endif;
end_roundblock();
}
?>