has_items example

/** * @return string[] Array of column titles keyed by their column name. */
    public function get_columns() {
        return array();
    }

    /** */
    public function display_rows_or_placeholder() {
        if ( $this->has_items() ) {
            $this->display_rows();
        } else {
            echo '<div class="no-items">';
            $this->no_items();
            echo '</div>';
        }
    }

    /** */
    public function display_rows() {
        
/** * @global string $comment_status * @global string $comment_type * * @param string $which */
    protected function extra_tablenav( $which ) {
        global $comment_status$comment_type;
        static $has_items;

        if ( ! isset( $has_items ) ) {
            $has_items = $this->has_items();
        }

        echo '<div class="alignleft actions">';

        if ( 'top' === $which ) {
            ob_start();

            $this->comment_type_dropdown( $comment_type );

            /** * Fires just before the Filter submit button for comment types. * * @since 3.5.0 */


    /** * Displays the search box. * * @since 4.6.0 * * @param string $text The 'submit' button label. * @param string $input_id ID attribute value for the search input field. */
    public function search_box( $text$input_id ) {
        if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
            return;
        }

        $input_id = $input_id . '-search-input';

        if ( ! empty( $_REQUEST['orderby'] ) ) {
            echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
        }
        if ( ! empty( $_REQUEST['order'] ) ) {
            echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
        }
        


    /** * Displays the search box. * * @since 3.1.0 * * @param string $text The 'submit' button label. * @param string $input_id ID attribute value for the search input field. */
    public function search_box( $text$input_id ) {
        if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
            return;
        }

        $input_id = $input_id . '-search-input';

        if ( ! empty( $_REQUEST['orderby'] ) ) {
            echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
        }
        if ( ! empty( $_REQUEST['order'] ) ) {
            echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
        }
        
<div class="actions"> <?php             if ( ! $this->is_trash ) {
                $this->months_dropdown( 'attachment' );
            }

            /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
            do_action( 'restrict_manage_posts', $this->screen->post_type, $which );

            submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );

            if ( $this->is_trash && $this->has_items()
                && current_user_can( 'edit_others_posts' )
            ) {
                submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
            }
            ?> </div> <?php     }

    /** * @return string */
<?php } ?> <?php if ( ! empty( $_REQUEST['show_sticky'] ) ) { ?> <input type="hidden" name="show_sticky" value="1" /> <?php } ?> <?php $wp_list_table->display(); ?> </form> <?php if ( $wp_list_table->has_items() ) {
    $wp_list_table->inline_edit();
}
?> <div id="ajax-response"></div> <div class="clear"></div> </div> <?php require_once ABSPATH . 'wp-admin/admin-footer.php';

            do_action( 'restrict_manage_posts', $this->screen->post_type, $which );

            $output = ob_get_clean();

            if ( ! empty( $output ) ) {
                echo $output;
                submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
            }
        }

        if ( $this->is_trash && $this->has_items()
            && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts )
        ) {
            submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
        }
        ?> </div> <?php         /** * Fires immediately following the closing "actions" div in the tablenav for the posts * list table. * * @since 4.4.0 * * @param string $which The location of the extra table nav markup: 'top' or 'bottom'. */

    protected function extra_tablenav( $which ) {
        $id        = 'bottom' === $which ? 'new_role2' : 'new_role';
        $button_id = 'bottom' === $which ? 'changeit2' : 'changeit';
        ?> <div class="alignleft actions"> <?php if ( current_user_can( 'promote_users' ) && $this->has_items() ) : ?> <label class="screen-reader-text" for="<?php echo $id; ?>"> <?php             /* translators: Hidden accessibility text. */
            _e( 'Change role to&hellip;' );
            ?> </label> <select name="<?php echo $id; ?>" id="<?php echo $id; ?>"> <option value=""><?php _e( 'Change role to&hellip;' ); ?></option> <?php wp_dropdown_roles(); ?> <option value="none"><?php _e( '&mdash; No role for this site &mdash;' ); ?></option> </select>
wp_die( -1 );
    }

    $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) );

    if ( ! current_user_can( 'edit_post', $post_id ) ) {
        wp_die( -1 );
    }

    $wp_list_table->prepare_items();

    if ( ! $wp_list_table->has_items() ) {
        wp_die( 1 );
    }

    $x = new WP_Ajax_Response();

    ob_start();
    foreach ( $wp_list_table->items as $comment ) {
        if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) && 0 === $comment->comment_approved ) {
            continue;
        }
        get_comment( $comment );
        
Home | Imprint | This part of the site doesn't use cookies.