当我访问我的博客页面时,我唯一看到的是链接“显示较旧的帖子”。当我点击它并转到第二页时,所有帖子都会正确显示。为什么第一页上什么都没有?
链接: http://www.solar-sell.eu/projecten/
代码:
<div class="content-bar">
<?php
$limit = get_option('posts_per_page');
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('showposts=' . $limit . '&paged=' . $paged);
$wp_query->is_archive = true;
$wp_query->is_home = false;
?>
<!-- Start the Loop. -->
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<!-- Test if the current post is in category 2. -->
<?php if ( in_category('2') ) { ?>
<!--post start-->
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2 class="post_title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(esc_attr__('Permalink to %s', 'black-bird'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></h2>
<div class="post_content">
<?php if (has_post_thumbnail()) { ?>
<a style="float: right;" href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('post_thumbnail', array('class' => 'postimg')); ?>
</a>
<?php } else { ?>
<?php if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail())) { ?>
<?php blackbird_get_thumbnail(300, 120); ?>
<?php } else { ?>
<?php blackbird_get_image(300, 120); ?>
<?php
}
?>
<?php
}
?>
<?php the_excerpt(); ?>
<div class="clear"></div>
<?php if (has_tag()) { ?>
<div class="tag">
<?php the_tags(__('Bericht getagd met ', ', ', '')); ?>
</div>
<?php } ?>
<br />
</div>
<ul class="post_meta clearfix">
<!--<li class="posted_by"><span><?php _e('Geplaatst door', 'black-bird'); ?></span> <img src="<?php echo get_template_directory_uri(); ?>/images/admin.png" /><?php the_author_posts_link(); ?></li>
<li class="post_category"><span><?php _e('Posted in', 'black-bird'); ?></span> <?php the_category(', '); ?></li>
<li class="post_date"><img src="<?php echo get_template_directory_uri(); ?>/images/date.png" /> <?php echo get_the_time('M, d, Y') ?></li> -->
<a class="read_more" href="<?php the_permalink() ?>"><?php _e('Lees Meer', 'black-bird'); ?></a>
<li class="post_comment"><img src="<?php echo get_template_directory_uri(); ?>/images/comment.png" /> <span><?php comments_popup_link('Geen reacties.', '1 Reactie.', '% Reacties.'); ?></span></li>
</ul>
</div>
<?php } else {} ?>
<!--End Post-->
<?php
endwhile;
else:
?>
<div class="post">
<p>
<?php _e('Sorry, no posts matched your criteria.', 'black-bird'); ?>
</p>
</div>
<?php endif; ?>
<!--End Loop-->
<nav id="nav-single" style="margin-top:20px;"> <span class="nav-previous">
<?php next_posts_link( __( '← Oudere berichten', 'black-bird' ) ); ?>
</span> <span class="nav-next">
<?php previous_posts_link( __( 'Nieuwere berichten →', 'black-bird' ) ); ?>
</span> </nav>
</div>