Advertisement
Guest User

Offset

a guest
Feb 10th, 2013
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.30 KB | None | 0 0
  1. <?php get_header(); ?>
  2. <?php $page = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; ?>
  3. <?php $offset = ( $page - 1 ) * 9 + 1; ?>
  4.  
  5.  <div id="content">
  6.  
  7.      <div id="featured">
  8.  
  9.          <!-- If home page, show featured image, if not... don't show anything -->
  10.  
  11.          <?php if(! $paged || $paged < 2) :  ?>
  12.           <?php if (have_posts()) :  ?>
  13.            <?php query_posts('showposts=1'); while (have_posts()) : the_post();  ?>
  14.            <a href="<?php the_permalink() ?>" title="<?php echo get_the_excerpt(); ?>"><?php the_post_thumbnail('featured-image');  ?></a>
  15.            <h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3>
  16.            <div class="featured-cat"><?php the_category(', ') ?></div>
  17.            <div class="featured-info">
  18.            <?php $myExcerpt = get_the_excerpt(); $tags = array("<p>", "</p>"); $myExcerpt = str_replace($tags, "", $myExcerpt); echo $myExcerpt; ?>
  19.            <a href="<?php the_permalink() ?>">Continue Reading</a>
  20.            </div><!-- /.featured-info -->
  21.  
  22.             <?php endwhile;?>
  23.             <?php wp_reset_query(); ?>
  24.           <?php endif; ?>
  25.          <?php endif; ?>
  26.  
  27.     </div><!-- /#featured -->
  28.  
  29.     <div id="posts">
  30.  
  31.         <!-- If home page show 9 thumbs with an offset of 1, 10, 19, 28, 37, etc -->
  32.  
  33.          <?php  if (have_posts()) : ?>
  34.  
  35.             <?php query_posts('posts_per_page=9&paged='.$paged.'&offset='.$offset); while ( have_posts() ) : the_post(); ?>
  36.               <?php include("incl/post.php"); ?>
  37.             <?php endwhile;?>
  38.            <?php wp_reset_query(); ?>
  39.          <?php endif; ?>
  40.  
  41.          <!-- If other, be normal, there is a known bug here -->
  42.  
  43.         <div id="browsing">
  44.             <div class="browse-nav">
  45.                 <div class="browse-left"><?php previous_posts_link('previous') ?>&nbsp;</div><!-- /.browse-left -->
  46.                 <div class="browse-mid"><div class="navigation"><?php if(function_exists('pagenavi')) { pagenavi(); } ?></div></div><!-- /.browse-mid -->
  47.                 <div class="browse-right"><?php next_posts_link('next') ?>&nbsp;</div><!-- /.browse-right -->
  48.             </div><!-- /.browse-nav -->
  49.             <div class="clear"></div>
  50.         </div><!--  /#browsing -->
  51.  
  52.     </div><!-- /#posts -->
  53. </div><!-- /#content -->
  54.  
  55. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement