WP_Themes_List_Table::prepare_items() –

You appear to be a bot. Output may be restricted

Description

Usage

WP_Themes_List_Table::prepare_items();

Parameters

Returns

void

Source

File name: wordpress/wp-admin/includes/class-wp-themes-list-table.php
Lines:

1 to 37 of 37
  public function prepare_items() {
    $themes = wp_get_themes( array( 'allowed' => true ) );

    if ( ! empty( $_REQUEST['s'] ) ) {
      $this->search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', strtolower( wp_unslash( $_REQUEST['s'] ) ) ) ) ) );
    }

    if ( ! empty( $_REQUEST['features'] ) ) {
      $this->features = $_REQUEST['features'];
    }

    if ( $this->search_terms || $this->features ) {
      foreach ( $themes as $key => $theme ) {
        if ( ! $this->WP_Themes_List_Table::search_theme( $theme ) ) {
          unset( $themes[ $key ] );
        }
      }
    }

    unset( $themes[ get_option( 'stylesheet' ) ] );
    WP_Theme::WP_Theme::sort_by_name( $themes );

    $per_page = 36;
    $page     = $this->get_pagenum();

    $start = ( $page - 1 ) * $per_page;

    $this->items = array_slice( $themes, $start, $per_page, true );

    $this->set_pagination_args(
      array(
        'total_items'     => count( $themes ),
        'per_page'        => $per_page,
        'infinite_scroll' => true,
      )
    );
  }
 

 View on GitHub View on Trac