Advertisement
bourkela

Excluding posts from "posts_per_page" count

Mar 10th, 2011
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. <div id="slides">
  2. <div class="slides_container">
  3.  
  4. <?php query_posts($query_string . 'posts_per_page=5');
  5. $ids = array();
  6. while ( have_posts() ) : the_post(); ?>
  7.  
  8. <div class="slide">
  9. <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
  10. <h1><?php the_title(); ?></h1>
  11. <p><?php the_excerpt(); ?></a></p>
  12. </div>
  13.  
  14. <?php $ids[]= $post->ID;
  15. endwhile; ?>
  16.  
  17. </div>
  18.  
  19. </div>
  20.  
  21. <section id="currentEvents">
  22. <h2 class="category"><?php wp_list_categories('include=7&title_li='); ?></h2>
  23. <?php global $post;
  24. $args = array( 'numberposts' => 5, 'category'=> 7 );
  25. $myposts = get_posts( $args );
  26. $postCount = 1;
  27. foreach( $myposts as $post ) : setup_postdata($post);
  28. if (!in_array($post->ID, $ids)) { ?>
  29.  
  30. <?php if($postCount == 1) { ?>
  31. <div class="firstPost">
  32. <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
  33. <h4><?php the_title(); ?></h4></a>
  34. </div>
  35.  
  36. <?php } else { ?>
  37. <div class="restOfPosts"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
  38. <h6><?php the_title(); ?></h6>
  39. </a>
  40. </div>
  41. <?php } ?>
  42.  
  43. <?php $postCount++; }
  44. endforeach; ?>
  45. </section>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement