• Resolved braehler

    (@braehler)


    Hey There,
    I have some issues with the output of shortcodes in custom endpoints.
    I declared some new endpoints with a shortcode to output the listings in my case.
    At the dashobard overview I have the navigation, but as soon as I click on the endpoint the contetn opens, but the navigation is gone.
    Any Ideas?

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Support Job a11n

    (@jobthomas)

    Automattic Happiness Engineer

    Hey @braehler could you provide a little bit more information about what your code looks like?

    Am I correct that:

    • You have the option to create the endpoints in your WP Admin
    • You can click on them in the My Account section
    • When doing the second step, the links to other endpoints are disappearing?
    Thread Starter braehler

    (@braehler)

    Here is my code

    
    
    function mein_stellenangebot_endpoint() {
    
        add_rewrite_endpoint( 'mein_stellenangebot', EP_ROOT | EP_PAGES );
    
    }
    
    add_action( 'init', 'mein_stellenangebot_endpoint' );
    
     
    
    // ------------------
    
    // 2. Add new query var
    
    function mein_stellenangebot_query_vars( $vars ) {
    
        $vars[] = 'mein_stellenangebot';
    
        return $vars;
    
    }
    
    add_filter( 'query_vars', 'mein_stellenangebot_query_vars', 0 );
    
     
    
    // ------------------
    
    // 3. Insert the new endpoint into the My Account menu
    
    function mein_stellenangebot_link_my_account( $items ) {
    
        $items['mein_stellenangebot'] = 'Meine Stellenanzeigen';
    
        return $items;
    
    }
    
    add_filter( 'woocommerce_account_menu_items', 'mein_stellenangebot_link_my_account' );
    
     
    
    // ------------------
    
    // 4. Add content to the new endpoint
    
    function mein_stellenangebot_content() {
    
    	echo do_shortcode( ' [jobd_dashboard] ' );
    
    }
    
    add_action( 'woocommerce_account_mein_stellenangebot_endpoint', 'mein_stellenangebot_content' );

    I get point into the navigation, but when you click on it the navigation is lost

    Stef

    (@serafinnyc)

    Your code worked for me. Maybe something else is conflicting with this? I got it to work.

    Thread Starter braehler

    (@braehler)

    MMhh, I′m sitting on that for ages and I′m not able to find the conflict.
    I set the whole endpoint up new on my staging. Now I′ve got the navigation, but now I can′t do anything with the listings, for example “renew” or “eddit”

    • This reply was modified 5 years, 6 months ago by braehler.
    Stef

    (@serafinnyc)

    That’s because you’ll need to add Ajax to that. It won’t work straight out of the box. I was working on something for adding a tracking shortcode there last year and found out I would need to add Ajax to anything I added there. Just haven’t had time to do it.

    Thread Starter braehler

    (@braehler)

    Damn, thats a tough one ??

    Stef

    (@serafinnyc)

    Hey I forgot to mention this. I’m not sure it’s relevant but did you save Permalinks after installing this snippet? You must do that in order to click that menu button and then content will show.

    But, anything in that field, say you wanted to save or press something in order to get a return value would need Ajax like I said.

    • This reply was modified 5 years, 6 months ago by Stef.
    • This reply was modified 5 years, 6 months ago by Stef.
    Thread Starter braehler

    (@braehler)

    Yes, permalink resave is always done. Then I get the menu items to work, but like you mentioned thats an ajax thing to return the values

    Stef

    (@serafinnyc)

    Yup. Ok. Just making sure you got that far.

    Thread Starter braehler

    (@braehler)

    Thanks man

    Stef

    (@serafinnyc)

    Ill post when I’m done with mine in git

    Thread Starter braehler

    (@braehler)

    That would be great

    Plugin Support Job a11n

    (@jobthomas)

    Automattic Happiness Engineer

    Any updates here @serafinnyc or @braehler or can I close this thread?

    Thread Starter braehler

    (@braehler)

    Still the issue with ajax and the shortcodes. I opend an issue on github for compatibility

    Stef

    (@serafinnyc)

    I’d close it @jobthomas as this is custom request not an issue

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Shortcodes in Custom Endpoints’ is closed to new replies.