Adding more complex shortcode to PHP code
-
Hello,
I have a shortcode which I want to use in the template, but the problem is I want to also include PHP code in it. Here is an example of what I am after.
<?php echo do_shortcode('[su_list icon="icon: angle-double-right" icon_color="#800000" ]<a href="#Savings">Savings in <?php echo $city; ?></a>[/su_list]'); ?>I want to output the city on the frontend i.e. “Savings in New York” but it looks like the php code is omited and I got only “Savings in” instead, is there any way to force it to work that way? The code works outside of shortcode without any problems.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Adding more complex shortcode to PHP code’ is closed to new replies.