Created
September 10, 2015 19:35
-
-
Save ericakfranz/ed0c0b3ff05247ab7be8 to your computer and use it in GitHub Desktop.
Remove all OptinMonster optins on mobile.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: OptinMonster - Remove Optins on Mobile Devices | |
* Plugin URI: http://optinmonster.com/ | |
* Description: Remove all OptinMonster optins from mobile devices using wp_is_mobile(); | |
* Version: 1.0.0 | |
* Author: Erica Franz | |
* Author URI: https://fatpony.me/ | |
* License: GPL2 | |
*/ | |
defined( 'ABSPATH' ) or die( 'No jellyfish!' ); | |
//* Filter wp_footer | |
add_action( 'wp_footer', 'ekf_om_remove_optins_mobile' ); | |
//* Remove all optins on mobile | |
function ekf_om_remove_optins_mobile() { | |
if( wp_is_mobile() ) { | |
echo "<script type='text/javascript'> | |
jQuery(document).ready(function($){ | |
jQuery(document).on('OptinMonsterBeforeShow', function(event, props, object){ | |
jQuery('#om-' + props.optin).remove(); | |
}); | |
}); | |
</script>"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment