Hi guys,
First of all I hope this is the right topic cause I couldn't place it in WP-advanced..
I've found a lot of info about this already but I've stumbled upon a problem. I'm trying to show a list of posts from the database with a date equal to today or in the future.
This is the code I use:
-- functions.php
function my_posts_where_from_today( $where = '' ) {
$where .= " AND post_date > '" . date('Y-m-d', strtotime('now')) . "'";
return $where;
}
add_filter( 'posts_where', 'my_posts_where_from_today' );
-- index.php
<?php query_posts( array( 'category_name' => 'games', 'post_status' => 'future || publish', 'post_type' => 'post', 'post_per_page' => '15', 'orderby' => 'date', 'order' => 'ASC' ) ); ?>
<?php while ( have_posts() ) : the_post(); ?>
//junk
<?php endwhile; ?>
<?php wp_reset_query(); ?>
My problem:
The code works like a charm but the filter is applied to every query. It seems logical but not really what I want.
How can I apply the above on just this query?
Thanks in advance,
Marcel