On the main blog page for a site I am developing, my designer has the first post styled uniquely and in a different section on the page than the rest. Since it is a paginated archive page, I need to loop through all posts on the paginated page just excluding the first post, as I will get that in it's own loop.

I tried the Offset option within the query, but learned that that kills pagination which won't work.

Thanks for the help.


You don't need separate queries, you can run multiple loops on the same query-

// output first post
if( have_posts() ){

// output the rest of the posts...
if( have_posts() ){
    while( have_posts() ){

You can also use rewind_posts() to reset the current post back to 0, as well as manually set $wp_query->current_post to whatever index you want and start the loop there (note: the post counter starts at 0, not 1).

If you only want to style the first post on the first page and not subsequent pages, you can check if it's not paged with ! is_paged()

if( ! is_paged() ){
    echo 'this will only output on the first page';
    if( have_posts() ){

Following this step:

Step 1: For different section you can display first Posts. when put this code.

// For your frist post
global $post,$firstPosts;
$args = array(
            'posts_per_page' => 1,
            'orderby' => 'post_date',
            'order' => 'DESC',
            'post_type' => 'post',
            'post_status' => 'publish',
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
    while ( $the_query->have_posts() ) : $the_query->the_post();
        $firstPosts[] = $post->ID;
        echo get_the_title();  

Step 2: On your blog page listing. Put this code in Index.php file. for Loop posts only excluding first post

// blog page
// Put this code after get_header(); line

global $wp_query,$firstPosts;
$args = array_merge( $wp_query->query,  array( 'post__not_in' => $firstPosts ) );
query_posts( $args ); 


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.