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

Untitled

By: a guest on Sep 19th, 2012  |  syntax: None  |  size: 1.06 KB  |  views: 49  |  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.         // don't edit this
  3.         global $wp_query;
  4.         $first_page_total= 9; // total number of posts on first page
  5.         $paginated_total = 10;
  6.         $found_posts = $wp_query->found_posts;
  7.         $pages = 1 + ceil(($found_posts - $first_page_total) / $paginated_total);
  8.         $wp_query->max_num_pages = $pages;
  9.         // start editing
  10. ?>
  11. <?php /* Start the Loop */ ?>
  12. <?php if ( have_posts() ) : ?>
  13.         <?php while ( have_posts() ) : the_post(); ?>
  14.                 <?php get_template_part( 'content', get_post_format() ); ?>
  15.         <?php endwhile; ?>
  16.         <?php if(!is_paged()) : ?>
  17.         <?php
  18.         $sticky = get_option( 'sticky_posts' );
  19.         $args = array(
  20.                 'posts_per_page' => 1,
  21.                 'post__in'      => $sticky,
  22.                 'ignore_sticky_posts' => 1
  23.         );
  24.         $the_query = new WP_Query( $args); ?>
  25.         <?php /* Start the sticky post loop */ ?>
  26.         <?php while ( $the_query->have_posts() ) : $the_query->the_post();      ?>
  27.         <?php
  28.         if ( $sticky[0] ) {
  29.                 get_template_part( 'content', get_post_format() );
  30.         }
  31.         ?>
  32.         <?php endwhile; ?>
  33.         <?php endif;    ?>
  34.         <!-- pagination functions here -->
  35.         <?php else : ?>
  36.         <!-- no post found text here -->
  37.         <?php endif; ?>