最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

jquery - shortcode execution when the page is opened

matteradmin6PV0评论

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
Add a comment  | 

1 Answer 1

Reset to default 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.

Post a comment

comment list (0)

  1. No comments so far