Advertisement
bowenac

Pulling excerpt from first post of category

Apr 4th, 2013
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.02 KB | None | 0 0
  1. <?php
  2. // the query to set the posts per page to 5
  3. $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  4. $args = array('posts_per_page' => 5, 'cat' => 4, 'order' => 'DESC', 'paged' => $paged );
  5. query_posts($args); ?>
  6. <!-- the loop -->
  7. <?php if ( have_posts() ) : while (have_posts()) : the_post(); ?>
  8.                     <div class="entry" >
  9.                         <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(array(150,150), array('class' => 'alignleft shadow')); ?></a>
  10.                         <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
  11.  
  12. <?php echo the_excerpt(30); ?>
  13.                         <p class="quick-read-more"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="readmore">Continue Reading...</a></p>                      
  14.                     </div>
  15.                     <hr />
  16. <?php endwhile; ?>
  17. <!-- pagination -->
  18. <div class="alignright"><?php next_posts_link(); ?></div>
  19. <div class="alignleft"><?php previous_posts_link(); ?></div>
  20. <?php else : ?>
  21. <!-- No posts found -->
  22. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement