Advertisement
Guest User

Untitled

a guest
Sep 20th, 2011
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.03 KB | None | 0 0
  1. <h1>Archives for <?php the_time('d'); single_month_title(' ');?></h1>
  2.                
  3.                 <div class="archive-navi">
  4.                     <?php
  5.                         $date = new DateTime(get_the_time('Y-m-d'));
  6.                         $nextday = new DateTime(get_the_time('Y-m-d'));
  7.                         $previousday = new DateTime(get_the_time('Y-m-d'));
  8.                         $nextday->add(new DateInterval('P1D'));
  9.                         $previousday->sub(new DateInterval('P1D'));
  10.  
  11.                         // Blog's first post was 21/5/2008, no point in allowing the user to navigate before this date
  12.                         if ($previousday->format('d-m-Y') == '20-05-2008') {
  13.                             echo $previousday->format('d');
  14.                         } else {
  15.                             echo '<a href="/news/archives/'.$previousday->format('Y').'/'.$previousday->format('m').'/'.$previousday->format('d').'">'.$previousday->format('d').'</a>';
  16.                         }
  17.                         echo '&nbsp;|&nbsp;';
  18.                         if ($nextday->format('d-m-Y') == date_i18n('d-m-Y')) {
  19.                             echo $nextday->format('d');
  20.                         } else {
  21.                             echo '<a href="/news/archives/'.$nextday->format('Y').'/'.$nextday->format('m').'/'.$nextday->format('d').'">'.$nextday->format('d').'</a>';
  22.                         }    
  23.                    
  24.                     ?>
  25.                 </div>
  26.                
  27.                 <ul class="archive">
  28.                
  29.                 <?php while ( have_posts() ) : the_post();
  30.                    
  31.                     if( $post->post_title != '' ) { ?>
  32.                         <li><h2 class="archive-item-time"><?php the_time('g:ia'); ?>:</h2>
  33.                             <h3 class="archive"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
  34.                         </li>
  35.                 <?php } else { echo "Sorry, there are no articles on this date"; } endwhile; ?>
  36.                 </ul>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement