Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @ryanphung,

    I hope you’re well today!

    The plugin doesn’t take into account parameters being passed like that. This particular rule is just for basic urls like posts, pages and other post types.

    This would require either an additional rule or an adjustment to the url rule.

    I’m checking on another possibility with this right now though, will report back here in just a bit on that. 🙂

    Cheers,
    David

    Hi @ryanphung,

    I’m really sorry for the delay here. I forgot I mentioned I’d reply back here after looking into a possible JavaScript-based solution for this, which I’ve since done.

    Unfortunately, the plugin’s URL rules are specific to URLs and don’t support parameters.

    But with a bit of creative JavaScript work, it should be possible to conditionally display popovers based on a parameter like so:

    function popover_url_parameters() {
    	if ( wp_script_is( 'jquery', 'done' ) ) {
    ?>
    	<script type="text/javascript">
    	// getUrlParameter() function from http://www.jquerybyexample.net/2012/06/get-url-parameters-using-jquery.html
    	function getUrlParameter(sParam) {
    		var sPageURL = window.location.search.substring(1);
    		var sURLVariables = sPageURL.split('&');
    		for (var i = 0; i < sURLVariables.length; i++) {
    			var sParameterName = sURLVariables[i].split('=');
    			if (sParameterName[0] == sParam)
    				return sParameterName[1];
    		}
    	}
    	jQuery( document ).ready(function() {
    		var promo = getUrlParameter('promotion');
    		if (promo != 'MAR2014') {
    			jQuery( 'div.visiblebox' ).hide();
    	}
    	});
    	</script>
    <?php
    	}
    }
    add_action( 'wp_footer', 'popover_url_parameters' );

    That would basically hide the popover unless that particular promotional code is in the url.

    It’d be easiest to test it out using Code Snippets:
    http://wordpress.org/plugins/code-snippets/

    Perhaps that’ll work for you?

    Cheers,
    David

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Popup based on url parameter’ is closed to new replies.