Created
January 24, 2019 20:18
-
-
Save ncesar/5a012e3f715094156c93235fad3768a8 to your computer and use it in GitHub Desktop.
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
add_filter ( 'woocommerce_account_menu_items', 'misha_one_more_link' ); | |
function misha_one_more_link( $menu_links ){ | |
// we will hook "anyuniquetext123" later | |
$new = array( 'anyuniquetext123' => 'Gift for you' ); | |
// or in case you need 2 links | |
// $new = array( 'link1' => 'Link 1', 'link2' => 'Link 2' ); | |
// array_slice() is good when you want to add an element between the other ones | |
$menu_links = array_slice( $menu_links, 0, 1, true ) | |
+ $new | |
+ array_slice( $menu_links, 1, NULL, true ); | |
return $menu_links; | |
} | |
add_filter( 'woocommerce_get_endpoint_url', 'misha_hook_endpoint', 10, 4 ); | |
function misha_hook_endpoint( $url, $endpoint, $value, $permalink ){ | |
if( $endpoint === 'anyuniquetext123' ) { | |
// ok, here is the place for your custom URL, it could be external | |
$url = site_url(); | |
} | |
return $url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment