AnsPress_Query::__construct( array $args = array() )

Description #

Initialize the class.

Parameters #

  • $args
    array (Optional) Arguments. Default value: array()

Source #

File: includes/class-query.php

137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
public function __construct( $args = array() ) {
    $this->paged  = isset( $args['paged'] ) ? (int) $args['paged'] : 1;
    $this->offset = $this->per_page * ( $this->paged - 1 );
 
    $this->args = wp_parse_args(
        $args,
        array(
            'user_id' => get_current_user_id(),
            'number'  => $this->per_page,
            'offset'  => $this->offset,
            'order'   => 'DESC',
        )
    );
 
    $this->per_page = $this->args['number'];
    $this->query();
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment