• Resolved birtak

    (@birtak)


    I have a website with daily more than 10 post’s. I have modified my recent posts to 20 in setting, so I cant use recent post’s code to show up my website today posts.

    I found this code to show my site today posts in home page:

    <?php
    // the query
    $today = getdate();
    $query = new WP_Query( 'year=' . $today["year"] . '&monthnum=' . $today["mon"] . '&day=' . $today["mday"] );
    ?>
    <?php if ( $the_query->have_posts() ) : ?>
    <!-- the loop -->
    
    <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    
    <?php else:  ?>
      <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
    <?php endif; ?>
    <!-- end of the loop -->

    but it doesn’t work.

    could you please anyone of friends help me?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Display Today post's in homepage’ is closed to new replies.