DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

If for some reason, you want to display only today’s posts on your blog homepage – or any other page – here’s a simple way to get theses posts and display it on your WordPress blog.

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');
if (have_posts()) :
     while (have_posts()) : the_post(); ?>
         // WordPress loop
endif; ?>

Leave a Comment

Your email address will not be published. Required fields are marked *