WPCF7_Contact_Form_List_Table::prepare_items
Метод класса: WPCF7_Contact_Form_List_Table{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$WPCF7_Contact_Form_List_Table = new WPCF7_Contact_Form_List_Table(); $WPCF7_Contact_Form_List_Table->prepare_items();
Код WPCF7_Contact_Form_List_Table::prepare_items() WPCF7 Contact Form List Table::prepare items CF7 6.1.5
public function prepare_items() {
$current_screen = get_current_screen();
$per_page = $this->get_items_per_page( 'wpcf7_contact_forms_per_page' );
$args = array(
'posts_per_page' => $per_page,
'orderby' => 'title',
'order' => 'ASC',
'offset' => ( $this->get_pagenum() - 1 ) * $per_page,
);
if ( $search_keyword = wpcf7_superglobal_request( 's' ) ) {
$args['s'] = $search_keyword;
}
if ( $order_by = wpcf7_superglobal_request( 'orderby' ) ) {
$args['orderby'] = $order_by;
}
if (
$order = wpcf7_superglobal_request( 'order' ) and
'desc' === strtolower( $order )
) {
$args['order'] = 'DESC';
}
$this->items = WPCF7_ContactForm::find( $args );
$total_items = WPCF7_ContactForm::count();
$total_pages = ceil( $total_items / $per_page );
$this->set_pagination_args( array(
'total_items' => $total_items,
'total_pages' => $total_pages,
'per_page' => $per_page,
) );
}