Title: Using php variable in shortcode
Last modified: January 23, 2019

---

# Using php variable in shortcode

 *  [Messaone](https://wordpress.org/support/users/messaone/)
 * (@messaone)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/using-php-variable-in-shortcode/)
 * I try to use your shortcode in a loop.
 *     ```
       $address = $module->render_post_address( $post_id );;
       echo do_shortcode( sprintf( '[leaflet-marker address="%s"]', $address ) );
       ```
   
 * It only adds the adress under the map.
    Maybe you have an idea how i can use 
   it like that.
    -  This topic was modified 7 years, 2 months ago by [Messaone](https://wordpress.org/support/users/messaone/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [bozdoz](https://wordpress.org/support/users/bozdoz/)
 * (@bozdoz)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/using-php-variable-in-shortcode/#post-11121765)
 * I’m surprised it didn’t work! I’ll have to try this myself and get back to you.
   Thanks for the interesting use case!
 *  Thread Starter [Messaone](https://wordpress.org/support/users/messaone/)
 * (@messaone)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/using-php-variable-in-shortcode/#post-11131138)
 * Oky now it works after reset the plugin.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Using php variable in shortcode’ is closed to new replies.

 * ![](https://ps.w.org/leaflet-map/assets/icon-256x256.png?rev=1693083)
 * [Leaflet Map](https://wordpress.org/plugins/leaflet-map/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/leaflet-map/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/leaflet-map/)
 * [Active Topics](https://wordpress.org/support/plugin/leaflet-map/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/leaflet-map/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/leaflet-map/reviews/)

## Tags

 * [adress](https://wordpress.org/support/topic-tag/adress/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)

 * 2 replies
 * 2 participants
 * Last reply from: [Messaone](https://wordpress.org/support/users/messaone/)
 * Last activity: [7 years, 2 months ago](https://wordpress.org/support/topic/using-php-variable-in-shortcode/#post-11131138)
 * Status: not resolved