Need help!!! How to hide the post based on the date?
-
I want one of my categories only show future post and the old post will be disappear after past the post date. How can I do this. I have used the plugin future is now, and it shows the future post on my blog. But I couldn’t get the old post gone. Below is the code I am using. Any help is appreciated.
<?php query_posts(‘cat=3&showposts=3&order=asc&orderby=date’); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post();
$onedaysago = date(“Y-m-d”,mktime(0,0,0,date(“m”),date(“d”)-1,date(“Y”)));
$currentdate = date(“Y-m-d”,mktime(0,0,0,date(“m”),date(“d”),date(“Y”)));
$postdate = the_date(‘Y-m-d’,”,”,false);?>
<?php
if ($postdate > $onedaysago) {
echo $postdate;
?><div <?php post_class() ?> id=”post-<?php the_ID(); ?>”>
<div class=”entry”>
<?php the_content(‘Detail’); ?>
</div>
</div>
<?php } ?>
<?php endwhile; ?><div class=”navigation”>
<div class=”alignleft”><?php next_posts_link(‘« Older Entries’) ?></div>
<div class=”alignright”><?php previous_posts_link(‘Newer Entries »’) ?></div>
</div><?php else : ?>
<h2 class=”center”>Not Found</h2>
<p class=”center”>Sorry, but you are looking for something that isn’t here.</p>
<?php get_search_form(); ?><?php endif; ?>
- The topic ‘Need help!!! How to hide the post based on the date?’ is closed to new replies.