答案 0 :(得分:1)
您必须在manage_edit-orders_columns
或自定义插件中使用functions.php
操作挂钩。
add_filter( 'manage_edit-orders_columns', 'changecolumnorder' );
function changecolumnorder( $columns ){
// one option is to "recreate" the whole array but you can do it with array_slice() function as well
// remove Date column first
unset( $columns['order_date'] );
// and add it into the correct place
return array_slice( $columns, 0, 3, true )
+ array( 'order_date' => __( 'Date', 'woocommerce' ) )
+ array_slice( $columns, 3, NULL, true );
}
我在编辑woocommerce插件文件的其他答案中看到了建议。请不要这样做!总是使用挂钩。更多可以自定义WooCommerce列的钩子here
答案 1 :(得分:-1)
插件\ woocommerce \包括\管理员\类-WC-管理员-后type.php
public function shop_order_columns( $existing_columns ) {
$columns = array();
$columns['cb'] = $existing_columns['cb'];
$columns['order_status'] = '<span class="status_head tips" data-tip="' . esc_attr__( 'Status', 'woocommerce' ) . '">' . esc_attr__( 'Status', 'woocommerce' ) . '</span>';
$columns['order_title'] = __( 'Order', 'woocommerce' );
$columns['order_date'] = __( 'Date', 'woocommerce' );
$columns['billing_address'] = __( 'Billing', 'woocommerce' );
$columns['shipping_address'] = __( 'Ship to', 'woocommerce' );
$columns['customer_message'] = '<span class="notes_head tips" data-tip="' . esc_attr__( 'Customer Message', 'woocommerce' ) . '">' . esc_attr__( 'Customer Message', 'woocommerce' ) . '</span>';
$columns['order_notes'] = '<span class="order-notes_head tips" data-tip="' . esc_attr__( 'Order Notes', 'woocommerce' ) . '">' . esc_attr__( 'Order Notes', 'woocommerce' ) . '</span>';
$columns['order_items'] = __( 'Purchased', 'woocommerce' );
$columns['order_total'] = __( 'Total', 'woocommerce' );
$columns['order_actions'] = __( 'Actions', 'woocommerce' );
return $columns;
}
将此代码替换为第264至280行 检查屏幕截图http://awesomescreenshot.com/04961cfedc
答案 2 :(得分:-1)
https://developer.wordpress.org/reference/classes/wp_list_table/get_columns/
扩展WP List Table类,在其中覆盖函数
如下所示,您的列按所需顺序
function get_columns() {
return $columns = array(
'title' => 'Title',
'properties' => 'Properties',
'stock'=>'Stock',
'price' => 'Price',
'published' => 'Published'
);
}