public function getAnswerPosts($from = null, $to = null)
    {
        $answerPosts = array(
            'posts_per_page' => -1,
            'post_type' => 'customer-feedback',
            'post_status' => array('publish', 'pending', 'draft'),
        );

        $answerPosts['date_query'] = array(
            'inclusive' => true
        );

        if (!is_null($from)) {
            $answerPosts['date_query']['after'] = $from;
        }

        if (!is_null($to)) {
            $answerPosts['date_query']['before'] = $to;
        }

        $answerPosts = new \WP_Query($answerPosts);
        return $answerPosts->posts;
    }
public function getAnswerPosts($from = null, $to = null)
    {
        $answerPosts = array(
            'posts_per_page' => -1,
            'post_type' => 'customer-feedback',
            'post_status' => array('publish', 'pending', 'draft'),
        );

        $answerPosts['date_query'] = array(
            'inclusive' => true
        );

        if (!is_null($from)) {
            $answerPosts['date_query']['after'] = $from;
        }

        if (!is_null($to)) {
            $answerPosts['date_query']['before'] = $to;
        }

        $answerPosts = new \WP_Query($answerPosts);
        return $answerPosts->posts;
    }
public function getAnswerPosts ( $ from = null , $ to = null ) { $ answerPosts = array ( 'posts_per_page' => - 1 , 'post_type' => 'customer-feedback' , 'post_status' => array ( 'publish' , 'pending' , 'draft' ) , ) ; $ answerPosts [ 'date_query' ] = array ( 'inclusive' => true ) ; if ( ! is_null ( $ from ) ) { $ answerPosts [ 'date_query' ] [ 'after' ] = $ from ; } if ( ! is_null ( $ to ) ) { $ answerPosts [ 'date_query' ] [ 'before' ] = $ to ; } $ answerPosts = new \ WP_Query ( $ answerPosts ) ; return $ answerPosts -> posts ; }
Get answer posts between dates
@param  string $from Date from
@param  string $to   Date to
@return array        Answer posts
Get answer posts between dates