using a variable inside do_shortcode()
-
Hi,
i’m trying to have custom shortcode nested in a plugin shortcode.
i learned that there is some limitation to WP shortcodes and to over come it I need to us the do_shortcode functioni used this in my function file
$childrens = do_shortcode(‘[products ids=”$string”]’);
based on some research I tried:
$childrens = do_shortcode(‘[products ids=”.’$string’.”]’);
and this
$childrens = do_shortcode(‘[products ids=\’$string’\]’);
with no success.in my custom template i can see the correct output for the $string variable using echo $string results in “41,402” so i know it works ok
when i use
$childrens = do_shortcode(‘[products ids=”41,402″]’);
i can see the desired behavior rendered on the page
when i use
$childrens = do_shortcode(‘[products ids=”$string”]’);
i get all the results for the [products} shortcode as it ignore the $string variable.any thoughts?
David
The page I need help with: [log in to see the link]
- The topic ‘using a variable inside do_shortcode()’ is closed to new replies.