要重命名我的帐户>订单:“查看”操作按钮文本,请使用以下命令:
// Rename My account > Orders "view" action button text
add_filter( 'woocommerce_my_account_my_orders_actions', 'change_my_account_my_orders_view_text_button', 10, 2 );
function change_my_account_my_orders_view_text_button( $actions, $order ) {
$actions['view']['name'] = __( 'View ticket', 'woocommerce' );
return $actions;
}
要重命名我的帐户“订单”菜单项,请使用以下(如果需要):
// Rename My account "Orders" menu item
add_filter( 'woocommerce_account_menu_items', 'rename_my_account_orders_menu_item', 22, 1 );
function rename_my_account_orders_menu_item( $items ) {
$items['orders'] = __("Ticket Orders", "woocommerce");
return $items;
}
代码在您的活动子主题(或活动主题)的function.php
文件中。经过测试和工作。
如果您只需要定位我的帐户>“订单”表,请使用is_wc_endpoint_url('orders')
条件标记:
// Rename My account > Orders "view" action button text
add_filter( 'woocommerce_my_account_my_orders_actions', 'change_my_account_my_orders_view_text_button', 10, 2 );
function change_my_account_my_orders_view_text_button( $actions, $order ) {
if( is_wc_endpoint_url( 'orders' ) )
$actions['view']['name'] = __( 'View ticket', 'woocommerce' );
return $actions;
}
代码在您的活动子主题(或活动主题)的function.php
文件中。经过测试和工作。