view_switcher example


    public function views() {
        global $mode;

        $views = $this->get_views();

        $this->screen->render_screen_reader_content( 'heading_views' );
        ?> <div class="wp-filter"> <div class="filter-items"> <?php $this->view_switcher( $mode ); ?> <label for="attachment-filter" class="screen-reader-text"> <?php                     /* translators: Hidden accessibility text. */
                    _e( 'Filter by type' );
                    ?> </label> <select class="attachment-filters" name="attachment-filter" id="attachment-filter"> <?php                     if ( ! empty( $views ) ) {
                        foreach ( $views as $class => $view ) {
                            
/** * @global string $mode List table view mode. * * @param string $which The location of the pagination nav markup: 'top' or 'bottom'. */
    protected function pagination( $which ) {
        global $mode;

        parent::pagination( $which );

        if ( 'top' === $which ) {
            $this->view_switcher( $mode );
        }
    }

    /** * Displays extra controls between bulk actions and pagination. * * @since 5.3.0 * * @param string $which The location of the extra table nav markup: 'top' or 'bottom'. */
    protected function extra_tablenav( $which ) {
        
/** * @global string $mode List table view mode. * * @param string $which */
    protected function pagination( $which ) {
        global $mode;

        parent::pagination( $which );

        if ( 'top' === $which ) {
            $this->view_switcher( $mode );
        }
    }

    /** * @return string[] Array of column titles keyed by their column name. */
    public function get_columns() {
        $users_columns = array(
            'cb'         => '<input type="checkbox" />',
            'username'   => __( 'Username' ),
            'name'       => __( 'Name' ),
            
Home | Imprint | This part of the site doesn't use cookies.