Home / loop / Display today’s posts only
  • How to Display today’s posts only

    display-todays-posts-only

    Adding this PHP code to your wordpress theme will display your wordpress post but only from the current day.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    <?php
    $day = date('j');
    query_posts('day='.$day);
    if (have_posts()) :
       while (have_posts()) : the_post();
    ?>
    <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="view: <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    <div class="storycontent"><?php the_content(); ?></div>
    <?php endwhile; ?>
    <?php endif; ?>
    

    ( WordPress codex functions, hooks, in this snippet. )

    the_content, the_title, the_permalink, query, have_posts, the_post, query_posts,