WordPress.org

Support

Support » How-To and Troubleshooting » Today’s posts from previous years – omit the current year from displaying?

Today’s posts from previous years – omit the current year from displaying?

  • Hello,

    I’ve created a simple query to pull posts from today’s date in previous years out of my db and display them on the index page.

    Unfortunately, my PHP isn’t enough up to snuff to figure out how to omit the current year’s post (from the current date) and prevent it from displaying. Here’s the code I’ve got so far:

    <?php $current_day = date('d'); ?>
    <?php $current_month = date('m'); ?>
    
    <?php 
    
    //query stories from day and month variables defined above
    query_posts("monthnum=$current_month&day=$current_day&order=DESC"); 
    
    	if (have_posts()) : ?>

    Any advice? Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Today’s posts from previous years – omit the current year from displaying?’ is closed to new replies.