提前感谢您对我一直在摸索的任何见解。
这是我用来调用主页上帖子的代码:(www.csmpromo.com)
<div id="home-posts">
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts(array( 'cat' => 'home', 'types' => $types, 'posts_per_page' => 19, 'paged' => $paged, ) ); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="home-post"><a href="<?php the_permalink(); ?>" class="transition">
<div class="home-image">
<?php if ( has_post_thumbnail() ) { the_post_thumbnail('home-thumb', array('class' => 'home-image')); } else { ?>
<img src="<?php bloginfo('template_directory'); ?>/img/fallback.jpg" alt="<?php the_title(); ?>" class="home-image" />
<?php } ?>
</div>
<?php the_titlesmall('', '<i class="icon-right-open-mini"></i>', true, '80') ?></a>
<div class="home-post-meta">
<i class="icon-user" style="font-size:7px; color:#9B362F"></i> <?php the_author_link(array('class' => 'home-author')); ?></span>
<i class="icon-feather" style="font-size:7px; color:#9B362F"></i> <?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?>
<i class="icon-chat" style="font-size:7px; color:#9B362F"></i> <?php comments_number('0 Comments', '1 Comments', '% Comments' );?></div>
</div>
<?php endwhile; endif; ?>
<div class="navigation">
<div class="alignleft"><?php previous_posts_link('« Previous') ?></div>
<div class="alignright"><?php next_posts_link('More »') ?></div>
</div>
<?php wp_reset_query(); ?>
</div>
我读过使用带有分页的 query_posts 有很多问题,但我尝试过的每个解决方案都失败了。
谢谢!