Created
February 21, 2017 11:16
-
-
Save kreamweb/04ff732a4bf8ce027c8a87ea8c211a3e to your computer and use it in GitHub Desktop.
function to hide show popup in mobile / desktop
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 | |
| function ywpop_hide_popup(){ | |
| if ( ! class_exists( 'YITH_Popup_Frontend' ) ) { | |
| return; | |
| } | |
| $current_popup = YITH_Popup_Frontend()->get_current_popup(); | |
| //popup da nascondere in desktop | |
| $popups_hidden_mobile = array( 106, 105 ); //da personalizzare | |
| //popup da nascondere in desktop | |
| $popups_hidden_desktop = array( 106, 109 ); //da personalizzare | |
| if ( wp_is_mobile() && in_array( $current_popup, $popups_hidden_mobile ) ) { | |
| add_filter( 'enable_yit_popup', '__return_false' ); | |
| } | |
| if ( ! wp_is_mobile() && in_array( $current_popup, $popups_hidden_desktop ) ) { | |
| add_filter( 'enable_yit_popup', '__return_false' ); | |
| } | |
| } | |
| add_action( 'template_redirect', 'ywpop_hide_popup', 9); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment