Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h1>Archives for <?php the_time('d'); single_month_title(' ');?></h1>
- <div class="archive-navi">
- <?php
- $date = new DateTime(get_the_time('Y-m-d'));
- $nextday = new DateTime(get_the_time('Y-m-d'));
- $previousday = new DateTime(get_the_time('Y-m-d'));
- $nextday->add(new DateInterval('P1D'));
- $previousday->sub(new DateInterval('P1D'));
- // Blog's first post was 21/5/2008, no point in allowing the user to navigate before this date
- if ($previousday->format('d-m-Y') == '20-05-2008') {
- echo $previousday->format('d');
- } else {
- echo '<a href="/news/archives/'.$previousday->format('Y').'/'.$previousday->format('m').'/'.$previousday->format('d').'">'.$previousday->format('d').'</a>';
- }
- echo ' | ';
- if ($nextday->format('d-m-Y') == date_i18n('d-m-Y')) {
- echo $nextday->format('d');
- } else {
- echo '<a href="/news/archives/'.$nextday->format('Y').'/'.$nextday->format('m').'/'.$nextday->format('d').'">'.$nextday->format('d').'</a>';
- }
- ?>
- </div>
- <ul class="archive">
- <?php while ( have_posts() ) : the_post();
- if( $post->post_title != '' ) { ?>
- <li><h2 class="archive-item-time"><?php the_time('g:ia'); ?>:</h2>
- <h3 class="archive"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
- </li>
- <?php } else { echo "Sorry, there are no articles on this date"; } endwhile; ?>
- </ul>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement