Advertisement
Guest User

Untitled

a guest
Apr 25th, 2014
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. <?php // display a list of recent case studies
  2. // instantiate an instance of WP_Query as a variable $recentPosts
  3. $recentPosts = new WP_Query();
  4. // get last 10 posts from category 7 (case studies)
  5. $recentPosts->query('showposts=4&cat=4');
  6. // utilize two methods to get at template tags (below)
  7. while ($recentPosts->have_posts()) :
  8. $recentPosts->the_post();
  9. ?>
  10. <div class="slide" ><a href="<?php // bump out what we need courtesy of template tags
  11. the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><h2><?php the_title(); ?></h2><?php echo excerpt(20); ?></a></div>
  12.  
  13. <?php endwhile; ?>
  14.  
  15. <?php
  16. $args = array( 'numberposts' => 6, 'order'=> 'DESC', 'orderby' => 'post_date', 'category' => 3 );
  17. $postslist = get_posts( $args );
  18. foreach ($postslist as $post) : setup_postdata($post);
  19. ?>
  20. <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
  21. <?php endforeach; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement