• Resolved parms

    (@parms)


    Hi, I have previously added some code to my website to create a custom endpoint with custom content in the WC My Account page.

    I’d like to do 2 other things now:

    1) Add another end point that is a URL pointing to another page on my website. I’m not too sure how to modify my code to make the endpoint a URL.

    2) I want to edit/add content on the main Dashboard page.

    I’ve added all of this via a custom php module available in WC Booster plugin.

    This is the code I’m currently using:

    /**
    * LEARNDASH
    * Register new endpoint to use for My account Page
    * Note: Resave permalinks or it will give 404 error
    */

    function courses_endpoint() {
    add_rewrite_endpoint( ‘courses’, EP_ROOT | EP_PAGES );
    }

    add_action( ‘init’, ‘courses_endpoint’ );

    /**
    * Add new query var
    */

    function courses_query_vars( $vars ) {
    $vars[] = ‘courses’;
    return $vars;
    }

    add_filter( ‘query_vars’, ‘courses_query_vars’, 0 );

    /**
    * Insert the new endpoint into the My Account menu
    */

    Function courses_link_my_account( $items ) {
    $items[‘courses’] = ‘Courses’;
    return $items;
    }

    add_filter( ‘woocommerce_account_menu_items’, ‘courses_link_my_account’ );

    /**
    * Add content to the new endpoint
    */

    Function courses_content() {
    echo do_shortcode( ‘ [ld_profile] ‘ );
    }

    add_action( ‘woocommerce_account_courses_endpoint’, ‘courses_content’ );

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Custom Woocommerce Endpoint URL’ is closed to new replies.