how to extract an attribute from a shortcode to use in a function?
I’m trying to write a function that looks into the content of a particular post for a Nextgen gallery shortcode, and then takes the number of the gallery in order to pull up a specific picture from the gallery.
So, for example, the shortcode in the post might be
What I want is to write a function that gets the value of the id in the shortcode (9, in the example), and assigns it to a variable, e.g. $gallerycodeID.
Is there a simple way to extract attributes like this from shortcodes in order to use them in other functions? Or do I need a regex string of some sort?
- The topic ‘how to extract an attribute from a shortcode to use in a function?’ is closed to new replies.