WordPress.org

Forums

posts on a page, between two dates query (1 post)

  1. Bartatwordpress
    Member
    Posted 2 years ago #

    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: http://codex.wordpress.org/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!

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 2 years ago by Bartatwordpress
  • This topic is not resolved
  • WordPress version: 3.4.2