• Resolved msearson

    (@msearson)


    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://ww.wp.xz.cn/plugins/popups/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Damian

    (@timersys)

    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

    (@msearson)

    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.