Calling an attribute from a plugin shortcode

The shortcode uses ‘postfix’ and ‘postfix_singular’, which can be used in your code in a few ways. You can pass them directly in your do_shortcode() call: echo do_shortcode(‘[rt_reading_time postfix=”minutes” postfix_singular=”minute”]’), but that doesn’t help when you want to use translations. For that, you can use sprintf() to create a string that gets passed to do_shortcode() … Read more

Nested shortcode functions accessing variable

After a bit of lateral thinking and lots of testing I was able to come up with a solution that negated the need for scope crossing variables, or using a global variable for that matter. The code goes like this: Split the nested $content(nested shortcodes) into single shortcodes with preg_match_all Apply do_shortcode to each shortcode … Read more