0

Is it possible to have a link to a page in my website trigger a shortcode button without leaving the home page!

I have a shortcode button that activates the ordering process for the customer but I need to use this button a lot throughout my page and it's not WooCommerce related.

I want to create a link that I can refer to anywhere on my website that would trigger the shortcode button as soon as it's clicked.

  • Was it bethought with no page refresh or reload? if so, it happens on the browser side and does not require WordPress. – Max Yudin Mar 26 at 5:51
0

No, shortcodes do not work this way as they are parsed on the server-side and replaced with the relevant content before the page is sent over to the visitor's browser.

What you could do is to place the shortcode within a hidden element (like a <div>), then have JavaScript/jQuery unhide the hidden element's content when a button is clicked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.