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.
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.
Share Improve this question edited Mar 26, 2019 at 5:48 Max Yudin 6,3882 gold badges26 silver badges36 bronze badges asked Mar 26, 2019 at 3:34 HossamudeHossamude 112 bronze badges 1- Was it bethought with no page refresh or reload? if so, it happens on the browser side and does not require WordPress. – Max Yudin Commented Mar 26, 2019 at 5:51
1 Answer
Reset to default 0No, 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.