unable to add custom page/tab to my account woocommerce
I have been trying over and over but have come up empty handed. I have followed this tutorial (https://www.atomicsmash.co.uk/blog/customising-the-woocommerce-my-account-section/) to create a new php page for 'My accounts' menu. for some reason it will not link to the new endpoint and constantly revert to dashboard...
here is the code I have added to my themes function.php file;
/**
* Register new endpoints to use inside My Account page.
*/
add_action( 'init', 'my_account_new_endpoints' );
function my_account_new_endpoints() {
add_rewrite_endpoint( 'earnings', EP_ROOT | EP_PAGES );
}
/**
* Get new endpoint content
*/
// Awards
add_action( 'woocommerce_earnings_endpoint', 'earnings_endpoint_content' );
function earnings_endpoint_content() {
get_template_part('earnings');
}
/**
* Edit my account menu order
*/
function my_account_menu_order() {
$menuOrder = array(
'dashboard' = __( 'Dashboard', 'woocommerce' ),
'orders' = __( 'Your Orders', 'woocommerce' ),
'earnings' = __( 'Earnings', 'woocommerce' ),
//'downloads' = __( 'Download', 'woocommerce' ),
'edit-address' = __( 'Addresses', 'woocommerce' ),
'edit-account' = __( 'Account Details', 'woocommerce' ),
'customer-logout' = __( 'Logout', 'woocommerce' ),
);
return $menuOrder;
}
add_filter ( 'woocommerce_account_menu_items', 'my_account_menu_order' );
I have saved and flushed the permalinks settings multiple times too... no luck. The new page I have added is in woocommerce/templates/myaccount/earnings.php
the earnings.php page simply has this so I know when and if I get it;
?php
echo ‘HELLO MOM’;
Thank you in advance :)
Topic woocommerce-offtopic account menus Wordpress
Category Web