Advertisement
Guest User

Wordpress PageofPosts template

a guest
Apr 11th, 2012
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: PageOfPosts
  4. */
  5.  
  6. get_header(); ?>
  7.  
  8. <div id="content" class="narrowcolumn">
  9.  
  10. <?php
  11. $showposts = -1; // -1 shows all posts
  12. $do_not_show_stickies = 1; // 0 to show stickies
  13. $args=array(
  14. 'showposts' => $showposts,
  15. 'caller_get_posts' => $do_not_show_stickies,
  16. );
  17. $my_query = new WP_Query($args);
  18.  
  19. ?>
  20.  
  21. <?php if( $my_query->have_posts() ) : ?>
  22.  
  23. <!--post title-->
  24. <h1 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h1>
  25.  
  26. <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
  27. <?php
  28. //necessary to show the tags
  29. global $wp_query;
  30. $wp_query->in_the_loop = true;
  31. ?>
  32. <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
  33. <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
  34. <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
  35.  
  36. <div class="entry">
  37. <?php the_content('Read the rest of this entry »'); ?>
  38. </div>
  39.  
  40. <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>
  41. </div>
  42.  
  43. <?php endwhile; ?>
  44.  
  45. <div class="navigation">
  46. <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>
  47. <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>
  48. </div>
  49.  
  50. <?php else : ?>
  51.  
  52. <h2 class="center">Not Found</h2>
  53. <p class="center">Sorry, but you are looking for something that isn't here.</p>
  54. <?php get_search_form(); ?>
  55.  
  56. <?php endif; ?>
  57.  
  58. </div>
  59.  
  60. <?php get_sidebar(); ?>
  61.  
  62. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement