Display wordpress today’s posts

October 20, 2008 · Print This Article

If you provide a lot of posts per days, it can be nice to display only today’s posts on a separate page. To achieve this, we’ll use the php date() function, and the WordPress query_posts() function.

Paste the following code where you want today’s posts to be displayed:
$current_day = date('j');
query_posts('day='.$current_day);
if (have_posts()) :
while (have_posts()) : the_post(); ?>
// WordPress loop
endwhile;
endif; ?>


Your choice for site templates and wordpress themes

Comments

Got something to say?

You must be logged in to post a comment.