mainecampus
Member
Posted 3 years ago #
I was wondering if there's a quick tag that displays the date and time of the most recent post. Right now I'm using this:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_time('l, F jS, Y, g:i a') ?></a>
<?php endwhile; ?>
<?php else : ?>
<p class="center">Move along, nothing to see here.</p>
<?php endif; ?>
But I need to be able to limit it to one post, and when I tried to do that it limited all the loops on the page to one post.
mainecampus
Member
Posted 3 years ago #
Well I was wondering if there was a tag that automatically added that information. This is what I have right now but it screws up my breadcrumb navigation:
<?php global $post;
$the_newest = get_posts('numberposts=1'); ?>
<?php foreach($the_newest as $post) : setup_postdata($post); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_time('F jS, g:i a') ?></a>
<?php endforeach; ?>
You will likely want to have a 'loop' that displays just that one post, then another that is your normal query loop.