반응형
Woocommerce의 내 계정 페이지에서 제목 변경
저는 WooCommerce my account 대시보드에서 내비게이션과 페이지를 재주문/변경하는 방법에 대한 많은 예를 보았습니다.그러나 각 섹션의 주요 제목(내 계정, 주문, 다운로드, 주소 등)을 변경하는 방법을 아무리 생각해도 알 수 없습니다.
저는 템플릿을 찾아봤지만 즐겁지 않았습니다.저는 조건부 php 주석을 사용하여 올바른 페이지의 제목을 반향해 보았습니다.하지만 제 계정 섹션은 엔드포인트를 사용하기 때문에 작동하지 않습니다.필터를 추가하려고 했지만, 기쁨이 없습니다.내가 이 제목들을 어떻게 바꾸는지 아는 사람?
감사해요.
복합 필터 후크를 사용하여 수행할 수 있습니다.woocommerce_endpoint_{$endpoint}_title
.
예를 들어 내 계정 "** 계정 세부 정보**" 제목을 변경해야 하는 경우(엔드포인트 위치):
add_filter( 'woocommerce_endpoint_edit-account_title', 'change_my_account_edit_account_title', 10, 2 );
function change_my_account_edit_account_title( $title, $endpoint ) {
$title = __( "Edit your account details", "woocommerce" );
return $title;
}
코드가 작동합니다.활성 하위 테마(또는 활성 테마)의 php 파일입니다.테스트를 거쳐 작동합니다.
woo_endpoint_title 필터를 사용하여 수행할 수 있습니다.
이렇게 하면 모든 계정 페이지의 제목을 변경할 수 있습니다.
function wpb_woo_endpoint_title( $title, $id ) {
if ( is_wc_endpoint_url( 'orders' ) && in_the_loop() ) {
$title = "Deine Buchungen";
}
elseif ( is_wc_endpoint_url( 'edit-address' ) && in_the_loop() ) {
$title = "Deine Rechnungs- & Behandlungsadresse";
}
elseif ( is_wc_endpoint_url( 'payment-methods' ) && in_the_loop() ) {
$title = "Deine Bezahlmethoden";
}
elseif ( is_wc_endpoint_url( 'edit-account' ) && in_the_loop() ) {
$title = "Dein Nutzerkonto";
}
return $title;
}
add_filter( 'the_title', 'wpb_woo_endpoint_title', 10, 2 );
언급URL : https://stackoverflow.com/questions/53438063/changing-the-titles-on-my-account-pages-in-woocommerce
반응형
'sourcecode' 카테고리의 다른 글
pandoc을 사용하여 Markdown에서 PDF로 변환할 때 마진 크기 설정 (0) | 2023.06.07 |
---|---|
그래프에 회귀선 방정식 및 R^2 추가 (0) | 2023.06.07 |
.NET 버전을 어떻게 찾습니까? (0) | 2023.06.07 |
find_spec_for_exe': 보석 번들러를 찾을 수 없습니다(>= 0.a) (Gem::GemNotFound예외) (0) | 2023.06.07 |
HTML을 NSA 속성으로 구문 분석텍스트 - 글꼴을 설정하는 방법? (0) | 2023.06.07 |