My Account Customizer - Compatibility with WoodMart Theme "My Account" widget
Please check the screenshot & staging below. You’ll see in the header that I’ve added the widget “My Account” from the Theme WoodMart. When you “hover” on this widget, you get an overview of the endpoints contained in it.
However, the structure isn’t well displayed there. We simply see the endpoints, not the structure. I wish to see the same structure into this. Is this feasible?
For now, I simpy use a “button” with a link rather than this widget. But I wish that your plugin would be compatible with this.
Comments (12)
-
repo owner -
reporter I can send the question to the support of my theme.
Can you tell me exactly what question I should ask them?
-
repo owner This falls into third party compatibility. anyone of both should provide compatibility for other as none of either is part of woocommerce core. It makes sense for us to provide compatiblity inside our plugin as woodmart has much wider audiance then us. I will be back to you after diving deeper into it.
-
reporter Thanks!
-
repo owner They do not have any hook to replace existing my account header menu. but if woodmart developers can make some changes in their plugin code , our plugin version higher than 2.2.12 will work with woodmart header my account menu.
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); } }
if they chose different hook other than
woodmart_override_heading_my_account_menu
let me know , i will update my plugin.
-
reporter I created a support ticket to WoodMart theme’s support, let’s see what they say
https://xtemos.com/forums/topic/add-a-hook-to-replace-the-existing-my-account-header-menu/
-
repo owner Thanks i have also purchased that theme. i will take part in discussion if required.
-
reporter -
repo owner typical reply rather than permanent fix .
you can copy paste below given code
// **********************************************************************// // ! 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); }
to your theme’s functions.php file. that will make it compatible with our plugin.
-
repo owner - changed status to resolved
including override function within plugin
-
reporter Hello, you said you included the “override function within the plugin” but I don’t see it. Is it by default or is it a setting?
-
repo owner It's not possible to override function from our plugin. It throws fatal error. So only option either have code snippet in child functions.php or wait for them to add any hook.
- Log in to comment
it is quite expected as there is no such thing as group in wooocmmerce core. its just added by our plugin and hooked into template folder. so by default they take registered menu items from wc_get_account_menu_items(); and show them one by one. By default they take group as endpoint.
I have to look into their source code. if they have hook provided to override only then it could be fixed or if they have separate template for this which is open to override.