WP_List_Table ColSpan的WordPress行动

时间:2014-08-16 18:48:49

标签: wordpress-plugin wordpress

我目前正在使用WP_List_Table为我的插件显示我的数据,并将rowactions绑定到第一列(如多个教程中所示)。我的表中有大约9列,并希望操作行跨越表中的所有列(或至少多个列),以便在调整浏览器大小时,操作不会包含在单个列中细胞。有谁知道如何做到这一点?

1 个答案:

答案 0 :(得分:1)

您可以覆盖名为single_row()的函数,并使用colspan写入您的行。

即,在子类中定义此函数,扩展WP_List_Table。

public function single_row( $item ) {
        static $row_class = '';
        $row_class = ( $row_class == '' ? ' class="alternate"' : '' );

        echo '<tr' . $row_class . '>';
        $this->single_row_columns( $item );
        echo '</tr>';

        // You can add a new row here with custom styles and attributes or edit the above one.
    }