• Hi all,

    I’m trying to customize the posts lists in the admin panel without modify the default scripts.

    I found the edit.php (wordpress\wp-admin\edit.php) and i found the line “<?php $wp_list_table->display(); ?>” this line render the posts list and is rendered from the class WP_Posts_List_Table (this class extends from WP_List_Table).

    I tried this but doesn’t work:

    class foo
    {
      function __construct() 
      {
        add_action('WP_Posts_List_Table',array( $this, 'AdminDisplayCustomTable'));
      }
    
      public function display() 
      {
        echo 'TESTTT';
    
        $singular = $this->_args['singular'];
    
        //$this->display_tablenav( 'top' );
    
        $this->screen->render_screen_reader_content( 'heading_list' );
        ?>
        <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
          <thead>
          <tr>
            <?php $this->print_column_headers(); ?>
          </tr>
          </thead>
    
          <tbody id="the-list"<?php
            if ( $singular ) {
              echo " data-wp-lists='list:$singular'";
            } ?>>
            <?php $this->display_rows_or_placeholder(); ?>
          </tbody>
    
          <tfoot>
          <tr>
            <?php $this->print_column_headers( false ); ?>
          </tr>
          </tfoot>
    
        </table>
        <?php
        $this->display_tablenav( 'bottom' );
      }
    }
    $foo = new foo();

    My question is: Have any way to add a custom funcion display() from a plugin script? and how can do this?

    Regards.-

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Admin – Add custom display() function for posts list’ is closed to new replies.