Created
February 12, 2019 18:32
-
-
Save iamandrewpeters/774975300234ea6228b73df9e444ea8c to your computer and use it in GitHub Desktop.
Change Endpoint titles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Change the endpoint menu order | |
*/ | |
function wpb_woo_my_account_order() { | |
$myorder = array( | |
'edit-account' => __( 'Change My Details', 'woocommerce' ), | |
'dashboard' => __( 'Dashboard', 'woocommerce' ), | |
'members-area' => __( 'My Courses', 'woocommerce' ), | |
'orders' => __( 'Orders', 'woocommerce' ), | |
'downloads' => __( 'Your Downloads', 'woocommerce' ), | |
'edit-address' => __( 'Addresses', 'woocommerce' ), | |
'payment-methods' => __( 'Payment Methods', 'woocommerce' ), | |
'customer-logout' => __( 'Logout', 'woocommerce' ), | |
); | |
return $myorder; | |
} | |
add_filter ( 'woocommerce_account_menu_items', 'wpb_woo_my_account_order' ); | |
/* | |
* Change the entry title of the endpoints that appear in My Account Page | |
*/ | |
function wpb_woo_endpoint_title( $title, $id ) { | |
if ( is_wc_endpoint_url( 'members-area/' ) && in_the_loop() ) { // add your endpoint urls | |
$title = "Courses"; // change your entry-title | |
} | |
return $title; | |
} | |
add_filter( 'the_title', 'wpb_woo_endpoint_title', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment