Php 更改“我的帐户订单”表中的“查看”按钮文本
我想自定义我的帐户>订单页面,将订单列表表中的“操作”列、“查看”按钮文本更改为“查看票据” 是否可以仅在“我的帐户”>“订单”页面上执行此操作 以下是澄清的屏幕截图:Php 更改“我的帐户订单”表中的“查看”按钮文本,php,wordpress,woocommerce,account,orders,Php,Wordpress,Woocommerce,Account,Orders,我想自定义我的帐户>订单页面,将订单列表表中的“操作”列、“查看”按钮文本更改为“查看票据” 是否可以仅在“我的帐户”>“订单”页面上执行此操作 以下是澄清的屏幕截图: 要重命名我的帐户订单:“查看”操作按钮文本,请使用以下命令: // Rename My account > Orders "view" action button text add_filter( 'woocommerce_my_account_my_orders_actions', 'change_my_account_
要重命名我的帐户订单:“查看”操作按钮文本,请使用以下命令:
// 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;
}
要重命名我的帐户“订单”菜单项,请使用以下命令(如果需要):
代码进入活动子主题(或活动主题)的function.php
文件。测试和工作
如果只需要针对我的帐户>“订单”表,请使用
is\u wc\u endpoint\u url(“订单”)
条件标记:
// 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
文件。经过测试,效果良好。没错,它很好用。谢谢你,它帮了很多忙。。如果我想添加此订单表,以便在主页面上再次显示我的帐户仪表板,该怎么办。但将“最近订单”文本更改为“票据订单”。。我可以吗?
// 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;
}