SHARE
TWEET

fool4Christ

a guest Sep 16th, 2007 1,145 Never
  1. <?php
  2.         // If we're on the index page, we only want the two first posts.
  3.         if ( is_home() && !is_paged() )
  4.                 query_posts('posts_per_page=2');
  5.  
  6.         // If we're within the index archives, we want ten posts per page as usual.
  7.         else {
  8.                 // If we are past the second page, offset by an appropriate amount for the page.
  9.                 // I'm by no means a math guru; I don't know why this works. Trial & error rocks!
  10.                 if ( get_query_var('paged') != 2 )
  11.                         $offsetting = 2 + ( ( get_query_var('paged') - 2 ) * get_query_var('posts_per_page') );
  12.  
  13.                 // If we're on the second page, offset by two.
  14.                 else
  15.                         $offsetting = 2;
  16.  
  17.                 // Plug it into our query.
  18.                 query_posts($query_string . "&offset=$offsetting");
  19.         }
  20. ?>
RAW Paste Data
Top