Add the WooCommerce account menu endpoints to the SuperSide Me menu panel.
<?php | |
// Do not include the opening tag. | |
add_filter( 'supersideme_menu_output', 'prefix_add_woo_account_menu_supersideme' ); | |
/** | |
* Mimic the WooCommerce account menu and add it to the SuperSide Me menu panel. | |
* | |
* @param $output_menu | |
* | |
* @return array | |
*/ | |
function prefix_add_woo_account_menu_supersideme( $output_menu ) { | |
if ( ! function_exists( 'wc_get_account_menu_items' ) || ! is_user_logged_in() ) { | |
return $output_menu; | |
} | |
$wc_menu = '<h3>' . __( 'My Account', 'prefix-text-domain' ) . '</h3>'; | |
foreach ( wc_get_account_menu_items() as $endpoint => $label ) { | |
$wc_menu .= sprintf( '<li class="%s"><a href="%s">%s</a></li>', | |
wc_get_account_menu_item_classes( $endpoint ), | |
esc_url( wc_get_account_endpoint_url( $endpoint ) ), | |
$label | |
); | |
} | |
$output_menu[] = $wc_menu; | |
return $output_menu; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment