Помогите понять, что не так.
Сделал пустое место, между первым и вторым постом для вставляния туда гуглета, в категории. После чего в категориях начало выводить все самые последние записи, а не только записи категорий.
<?php get_header(); ?>
<div id="content">
<?php include (TEMPLATEPATH . '/menu.php'); ?>
<br clear="all" />
<?php query_posts(''); ?> ///Для разбивки вывода постов
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
<?php /* If this is a category archive */ if (is_category()) { ?>
<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
<h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
<h2 class="pagetitle">Author Archive</h2>
<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<h2 class="pagetitle">Blog Archives</h2>
<?php } ?>
<?php if (have_posts()) : ?> ///Первая запись
<?php $firstpostquery = new WP_Query('showposts=1'); ?>
<?php while($firstpostquery->have_posts()) : $firstpostquery->the_post(); $firstpost = $post->ID; ?>
<div class="entry">
<h1 class="title" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h1></div>
////Конец первой записи и вставка баннера
<div class="entry3">
<?php the_content() ?>
</div>
<div class="entry4">
<div class="line"></div>
<p class="postmetadata">Дата: <?php the_time('j.m.Y') ?> | <?php if(function_exists('the_views')) { the_views(); } ?> Опубликовано в: <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('Нет комментариев, но можно написать!!! »', '1 комментарий »', '% комментариев »'); ?></p>
</div>
///вставка баннера
<div class="googleads1"><center><noindex></noindex></center></div>
<?php endwhile; ?>
<?php endif; ?>
///следующие записи
<?php if (have_posts()) : ?>
<?php $count=0; while (have_posts()) : the_post(); if(!($firstpost == $post->ID)) : ?>
<div class="entry">
<h1 class="title" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h1></div>
<div class="entry3">
<?php the_content() ?>
</div>
<div class="entry4">
<div class="line"></div>
<p class="postmetadata">Дата: <?php the_time('j.m.Y') ?> | <?php if(function_exists('the_views')) { the_views(); } ?> Опубликовано в: <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('Нет комментариев, но можно написать!!! »', '1 комментарий »', '% комментариев »'); ?></p>
</div>
<?php $count++; endif; ?>
<?php endwhile; ?>
<div class="navigation">
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
</div>
<?php else : ?>
<div class="entry">
<h2 class="center">Не найдено</h2>
</div>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Где я допустил ошибку в коде?