Advertisement
Guest User

dsader

a guest
Aug 26th, 2009
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: How Tos
  4. */
  5. ?>
  6.  
  7. <?php get_header(); ?>
  8.  
  9. <div class="content">
  10. <?php
  11. /************************* LOOP 1 Features one post in a longer excerpt**********************/
  12. query_posts('category_name=how-to&showposts=1');
  13. while (have_posts()) : the_post();
  14. $do_not_duplicate = $post->ID; // ID post to exclude in second loop
  15. ?>
  16. <div class="entry">
  17. <div id="post-<?php the_ID(); ?>">
  18. <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
  19. <?php add_filter('excerpt_length', create_function('','return "150";')); ?>
  20. <?php the_excerpt();
  21. //or
  22. // the_content();
  23. ?>
  24. <p class="postmetadata"><?php if (is_callable('the_tags')) the_tags('Tags: ', ', ', '<br />'); ?>Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p>
  25. </div>
  26. </div>
  27. <?php endwhile;
  28. /************************* LOOP 1 Ends **********************/
  29.  
  30. /************************* LOOP 2 Lists 5 as shorter excerpt**********************/
  31. query_posts('category_name=how-to&showposts=6'); //6 more mosts minus 1 excluded
  32. while (have_posts()) : the_post();
  33. if( $post->ID == $do_not_duplicate ) continue; //exclude the first single ID
  34. update_post_caches($posts);
  35. $do_not_duplicate_2[] = $post->ID; // ID the second set, now an array, of posts to exclude
  36. ?>
  37. <div class="entry">
  38. <div id="post-<?php the_ID(); ?>">
  39. <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
  40. <?php add_filter('excerpt_length', create_function('','return "55";')); ?>
  41. <?php the_excerpt(); ?>
  42. <p class="postmetadata"><?php if (is_callable('the_tags')) the_tags('Tags: ', ', ', '<br />'); ?>Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p>
  43. </div>
  44. </div>
  45. <?php endwhile;
  46. /************************* LOOP 2 Ends **********************/
  47.  
  48. /************************* LOOP 3 Lists 10 in sidebar markup **********************/
  49. ?>
  50. <ul>
  51. <?php
  52. query_posts('category_name=how-to&showposts=16'); //16 more posts minus those about to be excluded
  53. while (have_posts()) : the_post();
  54. if( $post->ID == $do_not_duplicate ) continue; //exclude the first single ID again
  55. if( in_array($post->ID, $do_not_duplicate_2) ) continue; //exclude the second IDs in array
  56. update_post_caches($posts);
  57. ?>
  58. <li id="post-<?php the_ID(); ?>">
  59. <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a>
  60. </li>
  61. <?php endwhile; ?>
  62. </ul>
  63. <?php
  64. /************************* LOOP 3 Ends **********************/
  65. ?>
  66. </div>
  67. <?php get_sidebar(); ?>
  68.  
  69. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement