Home › Forums › WoodMart support forum › Add a hook to replace the existing My Account header menu
Add a hook to replace the existing My Account header menu
- This topic has 1 reply, 2 voices, and was last updated 1 year, 8 months ago by
Artem Temos.
-
AuthorPosts
-
November 19, 2023 at 8:30 pm #513620
Jeriss Cloud CenterParticipantI’ve been in contact with the support team of the plugin My Account Customizer on Envato : https://codecanyon.net/item/woocommerce-customize-my-account-pro/31059126
And I’d need an improvement on WoodMart theme so that your My Account dropdown menu can be replaced and customized by whatever we wish to.
File to edit wp-content\themes\woodmart\inc\integrations\woocommerce\template-tags.php between line 1887-1904 find below given code
// **********************************************************************// // ! My account menu // **********************************************************************// if ( ! function_exists( 'woodmart_get_my_account_menu' ) ) { function woodmart_get_my_account_menu() { $user_info = get_userdata( get_current_user_id() ); $user_roles = $user_info->roles; $out = '<ul class="wd-sub-menu' . woodmart_get_old_classes( ' sub-menu' ) . '">'; foreach ( wc_get_account_menu_items() as $endpoint => $label ) { $out .= '<li class="' . wc_get_account_menu_item_classes( $endpoint ) . '"><a href="' . esc_url( wc_get_account_endpoint_url( $endpoint ) ) . '"><span>' . esc_html( $label ) . '</span></a></li>'; } return $out . '</ul>'; } }
and replace it with
// **********************************************************************// // ! My account menu // **********************************************************************// if ( ! function_exists( 'woodmart_get_my_account_menu' ) ) { function woodmart_get_my_account_menu() { $user_info = get_userdata( get_current_user_id() ); $user_roles = $user_info->roles; $out = '<ul class="wd-sub-menu' . woodmart_get_old_classes( ' sub-menu' ) . '">'; foreach ( wc_get_account_menu_items() as $endpoint => $label ) { $out .= '<li class="' . wc_get_account_menu_item_classes( $endpoint ) . '"><a href="' . esc_url( wc_get_account_endpoint_url( $endpoint ) ) . '"><span>' . esc_html( $label ) . '</span></a></li>'; } $out .= '</ul>'; return apply_filters('woodmart_override_heading_my_account_menu',$out); } }
Can you perform this change please?
ThanksNovember 20, 2023 at 1:31 pm #513771
Artem TemosKeymasterHello,
To override this content you can copy the whole function
woodmart_get_my_account_menu
to the child theme’s functions.php file and apply your changes there.Kind Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register