Create endpoint – My account
I have créate a new endpoint on the my account page.
It shows up but the content doesnt show up , someone that can helps ?
function my_custom_endpointsgift() {
add_rewrite_endpoint( 'my-custom-endpointgift', EP_ROOT | EP_PAGES );}
add_action( ‘init’, ‘my_custom_endpointsgift’ );
function my_custom_query_varsgift( $vars ) {
$vars[] = ‘my-custom-endpointgift’;
return $vars;
}
add_filter( ‘query_vars’, ‘my_custom_query_varsgift’, 0 );
/**
* Insert the new endpoint into the My Account menu.
*
* @param array $items
* @return array
*/
function my_custom_my_account_menu_itemsgift( $items ) {
// Remove the logout menu item.
$logout = $items[‘customer-logout’];
unset( $items[‘customer-logout’] );
// Insert your custom endpoint.
$items['my-custom-endpointgift'] = __( 'Tarjetas Regalo', 'woocommerce' );
// Insert back the logout item.
$items['customer-logout'] = $logout;
return $items;
}
add_filter( ‘woocommerce_account_menu_items’, ‘my_custom_my_account_menu_itemsgift’ );
/**
* Endpoint HTML content.
*/
function my_custom_endpoint_contentgift() {
echo '<p>Hello World!</p>';
}
add_action( ‘woocommerce_account_my-custom-endpoint_endpointgift’, ‘my_custom_endpoint_contentgift’ );
Thanks.
Leave an answer
You must login or register to add a new answer .