Advertisement
Guest User

Multiple Loops

a guest
Feb 10th, 2012
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. <?php $my_query = new WP_Query('category_name=news&posts_per_page=1');
  2. while ($my_query->have_posts()) : $my_query->the_post();
  3. $do_not_duplicate = $post->ID;?>
  4. <div id="featured-post" class="three columns">
  5. <a class="thumb-shadow" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
  6. <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { the_post_thumbnail('home-thumb', array("class" => "picture shadow")); } ?></a>
  7. <h4>What's New?</h4>
  8. <h5><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h5>
  9. <?php endwhile; wp_reset_postdata(); // End the loop ?>
  10. </div>
  11. <?php $my_query = new WP_Query('category_name=children&posts_per_page=1');
  12. while ($my_query->have_posts()) : $my_query->the_post();
  13. $do_not_duplicate = $post->ID;?>
  14. <div id="featured-post" class="three columns">
  15. <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
  16. <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { the_post_thumbnail('home-thumb', array("class" => "picture shadow")); } ?></a>
  17. <h4>Children</h4>
  18. <h5><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h5>
  19. <?php endwhile; wp_reset_postdata(); // End the loop ?>
  20. </div>
  21. <?php $my_query = new WP_Query('category_name=genealogy&posts_per_page=1');
  22. while ($my_query->have_posts()) : $my_query->the_post();
  23. $do_not_duplicate = $post->ID;?>
  24. <div id="featured-post" class="three columns">
  25. <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
  26. <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { the_post_thumbnail('home-thumb', array("class" => "picture shadow")); } ?></a>
  27. <h4>Genealogy</h4>
  28. <h5><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h5>
  29. <?php endwhile; wp_reset_postdata(); // End the loop ?>
  30. </div>
  31. <?php $my_query = new WP_Query('category_name=events&posts_per_page=1');
  32. while ($my_query->have_posts()) : $my_query->the_post();
  33. $do_not_duplicate = $post->ID;?>
  34. <div id="featured-post" class="three columns">
  35. <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
  36. <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { the_post_thumbnail('home-thumb', array("class" => "picture shadow")); } ?></a>
  37. <h4>Events</h4>
  38. <h5><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h5>
  39. <?php endwhile; wp_reset_postdata(); // End the loop ?>
  40. </div>
  41. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement