Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add link to BP Navigation


  • janaa
    Participant

    @janaa

    I want to add a link to the BP navigation that links to My Shopping Account (URL=“/profile/my-account/“).

    I’m a little overwhelmed by the variety of answers when I search on this topic, so I’m hoping someone can respond to my specific need.

Viewing 5 replies - 1 through 5 (of 5 total)

  • Prashant Singh
    Participant

    @prashantvatsh

    Hi,

    Please try this snippet:

    function ps_setup_nav() {
    	global $bp;
    
          bp_core_new_nav_item( array( 
                'name' => __( 'My Account', 'buddypress' ), 
                'slug' => 'my-account', 
                'position' => 30,
                'screen_function' => 'ps_account_page', 
          ) );
    }
     
    add_action( 'bp_setup_nav', 'ps_setup_nav' );
    
    function ps_account_page() {
    	add_action( 'bp_template_content', 'ps_account_content' );
    	bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    
    function ps_account_content(){
    	echo do_shortcode('[woocommerce_my_account]'); // If you are using WooCommerce otherwise can write your content instead of thus
    }

    Hopefully, it will help you.

    Thanks


    janaa
    Participant

    @janaa

    You are so kind @prashantvatsh to help me.

    I have implemented this code, and it is not displaying exactly what I want. Is it possible to replace the line
    echo do_shortcode('[woocommerce_my_account]');
    with an echo of a page URL?

    My page URL is “/my-shopping-account/”. Can you help me with this? (Sorry, but I can’t find the right example to follow so I need a bit more help).

    Thank you!


    Prashant Singh
    Participant

    @prashantvatsh

    That’s why I mentioned if you are using WooCommerce then otherwise not. Which plugin you are using to manage shop and accounts? We can only call the content on profile if they have any shortcode otherwise we can put a link on profile which will redirect to that page.

    Thanks


    janaa
    Participant

    @janaa

    Hi @prashantvatsh

    Thank you for getting back to me. I am using WooCommerce, so your code works! (You can ignore my previous question).

    Did I say, I really appreciate the support? Many thanks,
    Jana


    Prashant Singh
    Participant

    @prashantvatsh

    Welcome 🙂

    Glad to know that it helped 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar