I’m using PHP Widget which allows PHP code to execute from a widget. I tried using this code to execute do_shortcode but it’s not rendering
<?php $lat = get_field('woo_maps_lat'); $long = get_field('woo_maps_long'); echo do_shortcode('[forecast location="' . $lat .','.$long. '" measurement=\'C\']');
If I echo a variable with simply `echo $lat;’ it works. So the PHP Widget is working fine. The problem is echoing the shortcode in the widget. I can add shortcoded just fine to a widget but I need to be able to add the php variables where they are.
I tried adding
add_filter('widget_text', 'do_shortcode');to my functions.php but it’s still not rendering properly. Any suggestions?
- The topic ‘[Plugin: Weather Forecast – WP Wunderground] PHP Widget and do_shortcode?’ is closed to new replies.