更改 WooCommerce 订单支付页面标题
Change WooCommerce Order pay page title
正在尝试更改“订单支付”页面/“客户支付页面”的标题
https://url.com/checkout/order-pay/753/?pay_for_order=true&key=wc_order_xxxxxx
以下内容目前无效,它是通过更改感谢页面上的标题修改的。
add_filter( 'the_title', 'woo_title_pay_order', 10, 2 );
function woo_title_pay_order( $title, $id ) {
if ( function_exists( 'is_pay_for_order_page' ) &&
is_pay_for_order_page() && get_the_ID() === $id ) {
$title = "Checkout";
}
return $title;
}
已更新
您可以使用以下方法更改“订单付款”页面标题:
add_filter( 'the_title', 'change_pay_for_order_title' );
function change_pay_for_order_title( $title ) {
if ( is_wc_endpoint_url( 'order-pay' ) ) {
return __('Checkout', 'woocommerce');
}
return $title;
}
或者以下代码基于 'order-pay' 端点 (但更改面包屑):
add_filter( 'woocommerce_endpoint_order-pay_title', 'change_checkout_order_pay_title' );
function change_checkout_order_pay_title( $title ) {
return __( "Checkout", "woocommerce" );
}
代码进入活动 child 主题(或活动主题)的 functions.php 文件。已测试并有效。
相关:Set My Account custom items endpoints titles in WooCommerce
正在尝试更改“订单支付”页面/“客户支付页面”的标题
https://url.com/checkout/order-pay/753/?pay_for_order=true&key=wc_order_xxxxxx
以下内容目前无效,它是通过更改感谢页面上的标题修改的。
add_filter( 'the_title', 'woo_title_pay_order', 10, 2 );
function woo_title_pay_order( $title, $id ) {
if ( function_exists( 'is_pay_for_order_page' ) &&
is_pay_for_order_page() && get_the_ID() === $id ) {
$title = "Checkout";
}
return $title;
}
已更新
您可以使用以下方法更改“订单付款”页面标题:
add_filter( 'the_title', 'change_pay_for_order_title' );
function change_pay_for_order_title( $title ) {
if ( is_wc_endpoint_url( 'order-pay' ) ) {
return __('Checkout', 'woocommerce');
}
return $title;
}
或者以下代码基于 'order-pay' 端点 (但更改面包屑):
add_filter( 'woocommerce_endpoint_order-pay_title', 'change_checkout_order_pay_title' );
function change_checkout_order_pay_title( $title ) {
return __( "Checkout", "woocommerce" );
}
代码进入活动 child 主题(或活动主题)的 functions.php 文件。已测试并有效。
相关:Set My Account custom items endpoints titles in WooCommerce