diff --git a/includes/admin.php b/includes/admin.php index 9b53ed052..7e63660b3 100644 --- a/includes/admin.php +++ b/includes/admin.php @@ -9,6 +9,12 @@ class WP_Stream_Admin { */ public static $screen_id = array(); + /** + * List table object + * @var WP_Stream_List_Table + */ + public static $list_table = null; + const ADMIN_PAGE_SLUG = 'wp_stream'; const ADMIN_PARENT_PAGE = 'options-general.php'; @@ -58,6 +64,9 @@ public static function register_menu() { 'wp_stream_settings', array( __CLASS__, 'render_page' ) ); + + // Register the list table early, so it associates the column headers with 'Screen settings' + add_action( 'load-' . self::$screen_id['main'], array( __CLASS__, 'register_list_table' ) ); } /** @@ -136,14 +145,17 @@ public static function render_page() { prepare_items(); + self::$list_table = new WP_Stream_List_Table( array( 'screen' => self::$screen_id['main'] ) ); + } + + public static function stream_page() { + self::$list_table->prepare_items(); echo '
'; echo sprintf( '

%s

', __( 'Stream Records', 'stream' ) ); // xss okay - $list_table->display(); + self::$list_table->display(); echo '
'; }