• Hi

    I want to use this code on a page, to show posts on a page from a certain date till an other date:

    // Create a new filtering function that will add our where clause to the query
    function filter_where( $where = '' ) {
    	// posts for March 1 to March 15, 2010
    	$where .= " AND post_date >= '2010-03-01' AND post_date < '2010-03-16'";
    	return $where;
    }
    
    add_filter( 'posts_where', 'filter_where' );
    $query = new WP_Query( $query_string );
    remove_filter( 'posts_where', 'filter_where' );

    code from: https://codex.www.ads-software.com/Function_Reference/WP_Query#Time_Parameters

    Tried all possibilities but i don’t get it working.
    No errors, simpel not working.

    I know that i have to make this code working on a page but i don’t get it.

    Thanks, for tips and tricks!

  • The topic ‘posts on a page, between two dates query’ is closed to new replies.