Was a post posted within last 12 hours?
-
Hi everyone,
Was wondering if I could get a bit of help. Have looked at the forums but all related solutions I find mention variables such as $post, which I don’t have in my loop below I don’t think? What I want to do is check if each post in the loop was posted within the last 12 hours, and if so display an image (it’s just a small icon to alert the user that it’s a recent post). The simplified code for my loop is:
<?php while (have_posts()) : the_post(); ?>
<div class="post">
<h2 id="post-<?php the_ID(); ?>"><a>"<?php the_title();</a></h2>
<small><?php the_time('F jS') ?></small>
<div class="entry">
<?php the_content('Read more ?'); ?>
</div>
</div>
<?php endwhile; ?>
Would really appreciate any help anyone can give me – basically, if someone can tell me what the php IF statement is to check if it was posted in the last 12 hours, I know how to do the if… else and insert the image.
Thanks in advance,
Guy
- The topic ‘Was a post posted within last 12 hours?’ is closed to new replies.