Advertisement
Guest User

Untitled

a guest
Oct 20th, 2011
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Blog Template
  4. */
  5. ?>
  6. <?php get_header(); ?>
  7. <?php query_posts(‘cat=5′); ?>
  8. <?php if (have_posts()) : ?>
  9. <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
  10. <?php /* If this is a category archive */ if (is_category()) { ?>
  11. <h2 class="pagetitle">Archive for the &#8216;<?php single_cat_title(); ?>&#8217; Category</h2>
  12. <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
  13. <h2 class="pagetitle">Posts Tagged &#8216;<?php single_tag_title(); ?>&#8217;</h2>
  14. <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
  15. <h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>
  16. <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
  17. <h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>
  18. <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
  19. <h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
  20. <?php /* If this is an author archive */ } elseif (is_author()) { ?>
  21. <h2 class="pagetitle">Author Archive</h2>
  22. <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
  23. <h2 class="pagetitle">Blog Archives</h2>
  24. <?php } ?>
  25.  
  26. <?php while (have_posts()) : the_post(); ?>
  27. <div <?php post_class() ?> id="post-<?php the_ID(); ?>" style=" float: none;">
  28.  
  29. <div class="indent">
  30. <div class="title">
  31. <div class="date">
  32. <?php the_date(''); ?> <?php the_time(''); ?>
  33. </div>
  34.  
  35. <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
  36. <div class="author">
  37. <span>Author:</span> <?php the_author_link() ?>
  38. </div>
  39.  
  40.  
  41. </div>
  42.  
  43. <div class="text-box">
  44. <?php the_content('Read more'); ?>
  45. </div>
  46.  
  47. <div class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?></div>
  48.  
  49. <div class="comments">
  50. <?php comments_popup_link('read comments (0)', 'read comment (1)', 'read comments (%)', '' , 'off'); ?>
  51. </div>
  52.  
  53. <div class="link-edit"><?php edit_post_link('Admin', ''); ?></div>
  54.  
  55. </div>
  56.  
  57. </div>
  58. <?php endwhile; ?>
  59.  
  60. <div class="navigation nav-top">
  61. <div class="alignleft"><?php next_posts_link('&lt;&lt; Older entries') ?></div>
  62. <div class="alignright"><?php previous_posts_link('Newer entries &gt;&gt;') ?></div>
  63. </div>
  64.  
  65. <?php else :
  66.  
  67. if ( is_category() ) { // If this is a category archive
  68. printf("<h2 class='pagetitle'>Sorry, but there aren't any posts in the %s category yet.</h2>", single_cat_title('',false));
  69. } else if ( is_date() ) { // If this is a date archive
  70. echo("<h2 class='pagetitle'>Sorry, but there aren't any posts with this date.</h2>");
  71. } else if ( is_author() ) { // If this is a category archive
  72. $userdata = get_userdatabylogin(get_query_var('author_name'));
  73. printf("<h2 class='pagetitle'>Sorry, but there aren't any posts by %s yet.</h2>", $userdata->display_name);
  74. } else {
  75. echo("<h2 class='pagetitle'>No posts found.</h2>");
  76. }
  77. get_search_form();
  78.  
  79. endif;
  80. ?>
  81.  
  82.  
  83.  
  84. <?php get_footer(); ?>
  85.  
  86.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement