Last active
November 19, 2015 18:25
-
-
Save renanlara/2945646015bebbc2d346 to your computer and use it in GitHub Desktop.
Agendamento de Popup no Plugin Popup Maker
This file contains 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 | |
// Popup Maker - https://wordpress.org/plugins/popup-maker/ | |
function mycustom_popup_is_loadable( $is_loadable, $popup_id) { | |
if( $popup_id == 80 ) { // ID do Post | |
$start = strtotime( '2015-11-23 14:00:00' ); // Data de Início | |
$end = strtotime( '2015-11-26 23:59:00' ); // Data do Término | |
$now = strtotime( 'now' ); | |
if( $now >= $start && $now <= $end ) { | |
return true; | |
} | |
else { | |
return false; | |
} | |
} | |
// Caso use mais de um Popup | |
if( $popup_id == 91 ) { // ID do Post | |
$start = strtotime( '2015-11-27 00:00:00' ); // Data de Início | |
$end = strtotime( '2015-11-27 23:59:00' ); // Data do Término | |
$now = strtotime( 'now' ); | |
if( $now >= $start && $now <= $end ) { | |
return true; | |
} | |
else { | |
return false; | |
} | |
} | |
return $is_loadable; | |
} | |
add_filter('popmake_popup_is_loadable', 'mycustom_popup_is_loadable', 1000, 2 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment