Support » Fixing WordPress » Loop Question

  • 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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Ali Hussain

    (@b4db0y)

    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

    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.

    Thread Starter Ali Hussain

    (@b4db0y)

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Loop Question’ is closed to new replies.