Create WordPress ShortCode
-
Hello, I need a wordpress shortcode. The shortcode will work as follows: [get-button id=”1″] will return a template when used. I will use this shortcode in certain places on my page. For example, under a heading after the content, and again under a heading after the image. But the ids I call will be different everywhere. Like [get-button id=”4″]. What I want here is to collect all the ids and send a request to an API, then add my buttons to the places where I added the shortcode with the response returned from the API. How can I do that? For each button, I can send a request to an API and return a template based on the response. However, I will use at least 10 button shortcodes on my page, so I do not want to request the API 10 times. Thank you in advance for your answers.
The topic ‘Create WordPress ShortCode’ is closed to new replies.