Title: dynamic text
Last modified: September 1, 2016

---

# dynamic text

 *  Resolved [msearson](https://wordpress.org/support/users/msearson/)
 * (@msearson)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/dynamic-text/)
 * Does anyone know if I can put dynamic text in the poppup ? I want to have a different
   message each time I open it. So I was thinking something like:
    <span id=”mySpan”
   ></span) in the text section of the popup and then using Jquery to pop up the
   window and then something like jQuery(“#mySpan”).text(“whatver I want to write”)
 * Any help greatly appreciated. I can’t find anywhere I can use a popup in theis
   way. I had to make my own and it doesn’t look very good.
 * [https://wordpress.org/plugins/popups/](https://wordpress.org/plugins/popups/)

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

 *  Plugin Author [Damian](https://wordpress.org/support/users/timersys/)
 * (@timersys)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/dynamic-text/#post-7499075)
 * You could code a custom shortcode and then add the shortcode inside the popup.
   EG:
 * Place in your functions.php
 *     ```
       add_shortcode('random_msg', 'random_msg_func');
       function random_msg_func(){
       $msgs = array ( 'One message', 'another message');
       return  $msgs[array_rand($msgs)];
       }
       ```
   
 * and in your popup [random_msg]
 *  Thread Starter [msearson](https://wordpress.org/support/users/msearson/)
 * (@msearson)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/dynamic-text/#post-7499096)
 * Thanks. Looks interesting.
 * Just to clarify further –
 *  Then I would do something like
 * $popUpText = random_msg_func(” You got ” . $percent . ” percent”);
 *  to set the value. And then I would trigger the popup somehow, which would include
   the shortcode [random_msg]
 * Not exactly sure how I would trigger the popup either. I’ve seen some that will
   trigger from a button but not from a function.

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

The topic ‘dynamic text’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/popups_efeef0.svg)
 * [Popups - WordPress Popup](https://wordpress.org/plugins/popups/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/popups/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/popups/)
 * [Active Topics](https://wordpress.org/support/plugin/popups/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/popups/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/popups/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [msearson](https://wordpress.org/support/users/msearson/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/dynamic-text/#post-7499096)
 * Status: resolved