Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

fool4Christ

By: a guest on Sep 16th, 2007  |  syntax: PHP  |  size: 0.69 KB  |  views: 900  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. ?>