Support » Plugin: Popups - WordPress Popup » Random popup

  • Resolved dyrer

    (@dyrer)


    hello
    Can i have more than one popup for a specific page but with a random display?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support gonzalesc

    (@gonzalesc)

    Hi.
    Yes, you can do it using the hook “spu/check_for_matches“.

    First you must create 1 or more popups for a single page. For example “tusite.com/test_page”

    After you must put this code in your functions.php

    <?php
    if( !function_exists('timersys_popup_matches') ) {
    
    	function timersys_popup_matches($spu_matches, $spu_ids, $spu_rules) {
    
    		if( is_page('test_page') ) {
    
    			$key_rand = array_rand($spu_matches, 1);
    			$key_id = current($key_rand);
    
    			unset($spu_matches);
    			$spu_matches[$key_id] = $key_id;
    		}
    
    		return $spu_matches;
    	}
    
    	add_filter('spu/check_for_matches', 'timersys_popup_matches', 10, 3);
    }
    ?>

    This work in the page called “test_page”.

    Regards

    I want to have random popup for all pages not a specific.
    But even with a specific page shows both popups
    url is http://europelcs.com

    Plugin Support gonzalesc

    (@gonzalesc)

    Hi.
    In the detail popup, in the rules section, you can specific in what pages you want to the popup appears.

    How will work the random popup in all the pages?

    Regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Random popup’ is closed to new replies.