• Resolved capariciof

    (@capariciof)


    Hello, you know how I can make the popup open automatically using a command in php or html?

    I have a condition function (if… else) in php and I require the popup to open with one certain condition.

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

    (@timersys)

    Hi @capariciof,
    you usually don’t want to use php to open the popup because of page cache (if you are using any)
    But if you still need to do it, all you can do is wrap javascript code within your PHP conditional EG:

    <?php if( condition ) : ?>
        <script>SPU.open('123');</script>
    <?php endif;?>

    I do recommend using the shortcode generator or using pure html such as :<a href="#" class="spu-open-123">Click here</a>

    You can use the spu-open-XXX class with any html element. Simple replace XXX with your popup ID.

    If you like the plugin / support please leave a short review. It’s a tremendous help for us!

    Thanks

    Thread Starter capariciof

    (@capariciof)

    Does this code need to be located in any special position?

    Plugin Author Damian

    (@timersys)

    not really, but at a side note, this won’t work on ajax mode because the code will be printed before the popup exists.

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

The topic ‘Open Popup with conditional PHP code’ is closed to new replies.