0

I want to style the latest post differently than all the other posts in a category on a custom page. So far I have this code below which does exactly that:

<?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('&laquo; Previous') ?></div>
<div class="alignright"><?php next_posts_link('Next &raquo;') ?></div>
</div>

My question is, how would I then get the pagination to work correctly? Right now clicking Next/Previous loads a different page, but the posts stay the same.

I would like to be able to click Previous or Next, and it only load the style2 posts. Style 1 post would only show when on the front page of the custom page

dkris
  • 1
  • 1

1 Answers1

0
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( __( '&larr; Older Entries', 'dot1' ) ); ?>
                </div>
            <?php } ?>
            <?php if ( get_previous_posts_link() ) { ?>
                <div class="alignright">
                    <?php previous_posts_link( __( 'Newer Entries &rarr;', '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(); 
?>
Kumar
  • 2,889
  • 19
  • 19