我想将最新帖子的样式与自定义页面上某个类别中的所有其他帖子的样式不同。到目前为止,我有下面的代码,它正是这样做的:
<?php if (have_posts()) : ?>
 <?php query_posts("cat=4&showposts=1"); ?>
  <?php while (have_posts()) : the_post(); ?>
(Style1)<?php the_title(); ?></br>
  <?php endwhile; ?>
 <?php query_posts("cat=4&showposts=4&offset=1"); // show 4 latests posts excluding the latest ?>
  <?php while (have_posts()) : the_post(); ?>
(Style2)<?php the_title(); ?><br/>
 <?php endwhile; ?>
<?php else: ?>
No Posts Found
<?php endif; ?>
<div class="navigation">
<div class="alignleft"><?php previous_posts_link(\'« Previous\') ?></div>
<div class="alignright"><?php next_posts_link(\'Next »\') ?></div>
</div>
 我的问题是,如何才能使分页正常工作?现在单击“下一步/上一步”加载不同的页面,但帖子保持不变。
我想能够单击“上一步”或“下一步”,它只加载style2帖子。样式1帖子仅在自定义页面的首页显示
 
                SO网友:Kumar
                function dot1_get_nav(){
    if ( get_next_posts_link() || get_previous_posts_link() ) { ?>
        <nav class="dot1-navigation clearfix">
            <?php if ( get_next_posts_link() ) { ?>
                <div class="alignleft">
                    <?php next_posts_link( __( \'← Older Entries\', \'dot1\' ) ); ?>
                </div>
            <?php } ?>
            <?php if ( get_previous_posts_link() ) { ?>
                <div class="alignright">
                    <?php previous_posts_link( __( \'Newer Entries →\', \'dot1\' ) ); ?>
                </div>
            <?php } ?>
        </nav><?php
    }
}
<?php 
    $post_data_args = array(
        \'cat\'   => 4,
        \'showposts\' => 1
    );
    query_posts( $post_data_args );
    while ( have_posts() ) : 
        the_post();
        the_title();
    endwhile;
    wp_reset_query();
    $latest_post_data_args = array(
        \'cat\'   => 4,
        \'showposts\' => 4,
        \'offset\'    => 1
    );
    query_posts( $latest_post_data_args );
    while ( have_posts() ) : 
        the_post();
        the_title();
        endwhile;
            dot1_get_nav(); 
    wp_reset_query(); 
?>