Advertisement
rakeshr

list posts by taxonomy

Dec 31st, 2011
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.65 KB | None | 0 0
  1. <?php
  2.   $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  3.   $post_per_page = 1; // -1 shows all posts
  4.   $do_not_show_stickies = 1; // 0 to show stickies
  5.   $args=array(
  6.     //'genre' => 'mystery',
  7. //    'post_type' => 'apps',
  8.     'paged' => $paged,
  9.     'posts_per_page' => $post_per_page
  10.   );
  11.   $temp = $wp_query;  // assign orginal query to temp variable for later use
  12.   $wp_query = null;
  13.   $wp_query = new WP_Query($args);
  14.   if( have_posts() ) :
  15.         while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
  16.         <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
  17.         <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
  18.         <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
  19.         <div class="entry">
  20.           <?php the_content('Read the rest of this entry ยป'); ?>
  21.         </div>
  22.         <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments ', '1 Comment ', '% Comments '); ?></p>
  23.       </div>
  24.     <?php endwhile; ?>
  25.     <div class="navigation">
  26.       <div class="alignleft"><?php next_posts_link('< Older Entries') ?></div>
  27.       <div class="alignright"><?php previous_posts_link('Newer Entries >') ?></div>
  28.     </div>
  29.   <?php else : ?>
  30.  
  31.         <h2 class="center">Not Found</h2>
  32.         <p class="center">Sorry, but you are looking for something that isn't here.</p>
  33.         <?php get_search_form(); ?>
  34.  
  35.     <?php endif;
  36.  
  37.     $wp_query = $temp;  //reset back to original query
  38.  
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement