I'm doing a redesign of the woocommerce dashboard.
I had copy the dashboard.php from woocommerce folder to my theme folder.
So now I want to get rid of the side menu from dashboard only(Remain on other pages eg. account detail page)
Tried this code in dashboard.php, doesn't work.
add_filter ( 'woocommerce_account_menu_items', 'remove_my_account_links' );
function remove_my_account_links( $menu_links ){
unset( $menu_links['edit-address'] );
return $menu_links;
}
Understand this should be in function.php, but I only want to remove it from dashboard. How should I do that?
I'm doing a redesign of the woocommerce dashboard.
I had copy the dashboard.php from woocommerce folder to my theme folder.
So now I want to get rid of the side menu from dashboard only(Remain on other pages eg. account detail page)
Tried this code in dashboard.php, doesn't work.
add_filter ( 'woocommerce_account_menu_items', 'remove_my_account_links' );
function remove_my_account_links( $menu_links ){
unset( $menu_links['edit-address'] );
return $menu_links;
}
Understand this should be in function.php, but I only want to remove it from dashboard. How should I do that?
Share Improve this question asked Oct 22, 2018 at 9:10 Ng WilsonNg Wilson 111 silver badge4 bronze badges 2- You need to place this snippet in your child theme's functions.php – Akshat Commented Oct 22, 2018 at 14:43
- @Akshat The problem is it will remove the menu item on all my account pages, but I just need that to be remove on dashboard. – Ng Wilson Commented Oct 23, 2018 at 1:44
2 Answers
Reset to default 0You can override the dashboard.php
template by copying it over to /your-theme/woocommerce/myaccount/dashboard.php
.
From there it should be easy to customize it to your needs.
Thanks everyone I have solved this..
On myaccount.php remove
do_action( 'woocommerce_account_navigation' );
also remove if you want your content to be on the center of pages
<div class="woocommerce-MyAccount-content"></div>
then, on my-order.php, edit-address.php etc add in above code in the correct position, then upload to your theme folder so any update of woocommerce won't override this change