Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2011
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Walrus Reviews
  4. */
  5.  
  6. get_header(); ?>
  7.  
  8. <div id="container">
  9. <div id="content" class="narrowcolumn">
  10.  
  11. <?php
  12. if (is_page() ) {
  13. $category = get_post_meta($posts[0]->ID, 'category', true);
  14. }
  15. if ($category) {
  16. $cat = get_cat_ID($category);
  17. $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  18. query_posts('cat=4&posts_per_page='.get_option('posts_per_page').'&paged=' . $paged);
  19. $post_per_page = 10; // -1 shows all posts
  20. $do_not_show_stickies = 1; // 0 to show stickies
  21. $args=array(
  22. 'category__in' => array($cat),
  23. 'orderby' => 'date',
  24. 'order' => 'DESC',
  25. 'paged' => $paged,
  26. 'posts_per_page' => $post_per_page,
  27. 'caller_get_posts' => $do_not_show_stickies
  28. );
  29. $temp = $wp_query; // assign orginal query to temp variable for later use
  30. $wp_query = null;
  31. $wp_query = new WP_Query($args);
  32. if( have_posts() ) :
  33. while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
  34.  
  35. <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
  36.  
  37. <div class="entry">
  38. <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
  39. <p class="postmetadata"><small><?php the_time('F jS, Y') ?> <!-- by <?php //the_author() ?> --><span class="number-comments"><?php comments_popup_link('No Comments &raquo;', '1 Comment &raquo;', '% Comments &raquo;'); ?></span></small></p>
  40. <div class="review-text"><?php the_excerpt('More &raquo;'); ?></div>
  41.  
  42. </div>
  43.  
  44. </div>
  45. <?php endwhile; ?>
  46. <div class="navigation">
  47. <?php if(function_exists('wp_paginate')) {
  48. wp_paginate();
  49. } ?>
  50. </div>
  51. <?php else : ?>
  52.  
  53. <h2 class="center">Not Found</h2>
  54. <p class="center">Sorry, but you are looking for something that isn't here.</p>
  55. <?php get_search_form(); ?>
  56.  
  57. <?php endif;
  58.  
  59. $wp_query = $temp; //reset back to original query
  60.  
  61. } // if ($category)
  62. ?><!-- #content -->
  63. </div><!-- #container -->
  64.  
  65. <?php get_sidebar(); ?>
  66. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement