虽然此博客中有4个帖子,但我只想要显示3个帖子,这样可以正常工作http://bit.ly/sFcp4D。但是,当您单击下一个和上一个按钮时,它将移动到下一个帖子。我不确定为什么这不动。有人可以这样做,谢谢。
<!--BEGIN CONTENT-->
<article id="content">
<?php if (have_posts()) : the_post(); ?>
<div class="post post-page" id="post-<?php the_ID(); ?>">
<div class="post-content our-news">
<?php the_content(); ?>
<?php
$page = get_query_var( 'page' );
query_posts( array('category_name' => 'Our News', 'posts_per_page' => 3, 'paged' => $page));
?>
<ul id="news">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<li class="post" id="post-<?php the_ID(); ?>">
<div class="box">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
<?php the_post_thumbnail('portfolio-thumb'); ?>
</a>
</div>
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<span><?php the_time('F jS Y') ?></span>
<div class="entry">
<?php the_content(); ?>
</div>
</li>
<?php endwhile; ?>
<div class="clear">
</ul>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('<<', 3) ?></div>
<div class="alignright"><?php previous_posts_link('>>', 3) ?></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 endif; ?>
<?php wp_reset_query(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'HAWK_FRONT' ), 'after' => '</div>' ) ); //end link page ?>
<?php edit_post_link( __( 'Edit', 'HAWK_FRONT' ), '<div class="edit-link">', '</div>' ); //end edit link ?>
</div>
<!--end post page-->
<?php else : ?>
<!--BEGIN NO POST-->
<div class="no-post">
<h2><?php esc_html_e('Not Found', 'HAWK_FRONT'); ?></h2>
<p><?php esc_html_e("Sorry, but you are looking for something that isn't here.", 'HAWK_FRONT'); ?></p>
</div>
<!--END NO POST-->
答案 0 :(得分:0)
我看到6篇不同的文章,每页3篇。