WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Post Manager
Date filtering (1 post)

  1. Rain3r
    Member
    Posted 1 year ago #

    Hi,
    I would like to filter posts by post_date and post_modified. Currently I have datepicker text input field and operator select list, but I am not able to pass these parameters to wp_query.
    Column sorting is already OK.
    Using the sample code for post_status filtering I changed mainly two functions :
    public function parse_query($wp_query, $active) {
    //only test, do the job for one certain date
    $wp_query->set('monthnum', '5');
    $wp_query->set('day', '3');
    $wp_query->set('year', '2012');
    }
    public function form_row($return, $key, $value, $filter) {
    $query_options = array(
    '=' => 'Je', //Is
    '!=' => 'NenĂ­', //Is not
    '>' => '>',
    '<' => '<',
    '>=' => '>=',
    '<=' => '<='
    );
    $is_key = 'tribe_filters_is_'.$key;
    $ret .= Tribe_Filters::select_field( $is_key, $query_options, $value['query_option'] );
    $ret .= '<input type="text" name="'.$key.'" value="'.$value['value'].'" class="date tribe-datepicker">';
    return $ret;
    }
    Please, do you have any tips or slice of code how to achieve date filtering with compare operators <, >, <=, >=, =, !=?
    Thank you very much

    http://wordpress.org/extend/plugins/advanced-post-manager/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic