Forums

Loop Question (5 posts)

  1. b4db0y
    Member
    Posted 8 months ago #

    i am using the following loop

    query_posts( "cat=22&year=$current_year&monthnum=$current_month&order=ASC" );

    But i want to exclude the posts from the current month
    thanks

  2. esmi
    Theme Diva & Forum Moderator
    Posted 8 months ago #

  3. b4db0y
    Member
    Posted 8 months ago #

    i want to implement

    // 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' );

    `

    but in an array funtion like

    year => $current
    month => $funtion (last 11 months)

    Thanks

  4. duck__boy
    Member
    Posted 8 months ago #

    Maybe look at the time/date functions in PHP -

    $from_date = date('m')-335; I beleive will give you the month number from (aprox) 11 months ago.

  5. b4db0y
    Member
    Posted 8 months ago #

    @duck__boy Thanks
    But how can i put this under an array?

Reply

You must log in to post.

About this Topic