Advertisement
Guest User

Untitled

a guest
Apr 20th, 2011
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: PageOfPosts
  4. */
  5.  
  6. get_header(); ?>
  7.  
  8. <div id="content" class="page">
  9.  
  10. <?php
  11. // page id 34 will get category ID 6 posts, page 16 will get category 32 posts, page 28 will get category 17 posts
  12. if (is_page('9') ) {
  13. $cat = array(13);
  14. } elseif ( is_page('11') ) {
  15. $cat = array(6);
  16. } elseif ( is_page('2') ) {
  17. $cat = array(3);
  18. } elseif ( is_page('6') ) {
  19. $cat = array(4);
  20. } elseif ( is_page('8') ) {
  21. $cat = array(5);
  22. } elseif ( is_page('20') ) {
  23. $cat = array(7);
  24. } else {
  25. $cat = '';
  26. }
  27.  
  28. $showposts = -1; // -1 shows all posts
  29. $do_not_show_stickies = 1; // 0 to show stickies
  30. $args=array(
  31. 'category__in' => $cat,
  32. 'showposts' => $showposts,
  33. 'caller_get_posts' => $do_not_show_stickies
  34. );
  35. $my_query = new WP_Query($args);
  36.  
  37. ?>
  38.  
  39. <?php if( $my_query->have_posts() ) : ?>
  40.  
  41. <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
  42.  
  43. <?php
  44. //necessary to show the tags
  45. global $wp_query;
  46. $wp_query->in_the_loop = true;
  47. ?>
  48.  
  49. <div class="entry" id="post-<?php the_ID(); ?>">
  50.  
  51. <h1 class="entry-title"><?php the_title(); ?></h1>
  52.  
  53. <div class="entry-byline">
  54. <?php edit_post_link('Edit', '[', ']'); ?>
  55. </div>
  56.  
  57. <div class="entry-content">
  58. <?php the_content(); ?>
  59. <?php wp_link_pages('before=<p><strong>' . __('Pages:') . '</strong>&after=</p>'); ?>
  60. <div class="clear"></div>
  61. </div>
  62.  
  63. </div><!--.entry-->
  64.  
  65. <?php endwhile; ?>
  66.  
  67. <?php else : ?>
  68.  
  69. <h2 class="center">Not Found</h2>
  70. <p class="center">Sorry, but you are looking for something that isn't here.</p>
  71. <?php get_search_form(); ?>
  72.  
  73. <?php endif; ?>
  74.  
  75. </div>
  76.  
  77. <?php get_sidebar(); ?>
  78.  
  79. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement