Account Navigation Management

This document describes how account navigation endpoints are managed in The Golfer’s Journal theme.

Default Navigation Items

The theme uses WooCommerce’s account navigation system, which by default includes the following endpoints:

  • Dashboard
  • Orders
  • Downloads
  • Addresses
  • Account details
  • Logout

Customizing Navigation Items

The theme modifies the default navigation items using the woocommerce_account_menu_items filter. Here’s how it’s implemented:

add_filter( 'woocommerce_account_menu_items', function ( $items ){
    // Remove unwanted endpoints
    unset( $items['downloads'] );
    unset( $items['backinstock']);
    unset( $items['edit-address']);

    // Rename 'subscriptions' to 'Memberships'
    if (isset($items['subscriptions'])) {
        $items['subscriptions'] = __('Memberships', 'journal-concepts');
    }
 
    return $items;
}, 99 );

Adding Custom Navigation Items

The theme adds a “Help Center” link to the navigation menu:

add_filter( 'woocommerce_account_menu_items', function( $menu_items ) {
    if ( function_exists( 'array_insert_before' ) ) {
        $menu_items = array_insert_before( 'customer-logout', $menu_items, 'help-center', 'Help Center' );
    } else {
        $menu_items['help-center'] = 'Help Center';
    }
    return $menu_items;
}, 9999, 1 );

The Help Center link is configured to point to an external URL:

add_filter( 'woocommerce_get_endpoint_url', function( $url, $endpoint, $value, $permalink ) {
    if ( $endpoint == 'help-center' ) {
        $url = 'https://support.golfersjournal.com/hc/en-us';
    }
    return $url;
}, 10, 4 );

Conditional Navigation Display

The navigation menu is conditionally displayed based on the current endpoint. It is hidden for certain custom endpoints:

if ( is_user_logged_in() && 
    !is_wc_endpoint_url( 'member-locker' ) &&
    !is_wc_endpoint_url( 'broken-tee-society' ) &&
    !is_wc_endpoint_url( 'bts-discord' ) &&
    !is_wc_endpoint_url( 'referrals' ) &&
    !is_wc_endpoint_url( 'events' ) ) {
        do_action( 'woocommerce_account_navigation' ); 
}

The account navigation is rendered in two places:

  1. In the main account page template (woocommerce/myaccount/my-account.php)
  2. In the account flyout menu (header.php)

Both implementations use the same navigation items but may have different styling and layout.

Custom Endpoints

The theme includes several custom endpoints that are excluded from the main navigation:

  • Member Locker
  • Broken Tee Society
  • BTS Discord
  • Referrals
  • Events

These endpoints are accessed through custom tiles or other UI elements rather than the main navigation menu.