Scheduled Popups
If you want to make a scheduled popup, here are 3 ways to do that.
1) Schedule a Post Like a Normal Blog Post #
A popup is a custom post type in WordPress. So, you can schedule it for publishing on a future date and time. Just make sure your WordPress timezone setting is correct.
Learn more about scheduling a post from the WordPress Schedule a Post help manual.
2) Use Custom Code for Making a Scheduled Popup #
Scheduling a post is awesome if you only need a start date. What if you need a start and end time for your scheduled popup?
If you're comfortable writing PHP or are working with a developer, we have a basic code sample that turns one of your popups into a scheduled popup with a start and end time.
The code sample is great if you only need a simple schedule for 1 or 2 popups. As you can imagine, writing this code can get tedious (not to mention error-prone) when you want to schedule a lot of popups.
For more robust scheduling support, please check out our premium Schedules for Popups Extension.
Once you add this custom code to your site, change the popup ID below to the popup ID that you will be scheduling.
Don't forget to edit your dates and times!
<?php // Ignore this first line when copying to your child theme's functions.php file. function schedule_my_popup( $is_loadable, $popup_id ) { if( $popup_id == 14 ) { // Change to your popup ID. date_default_timezone_set('Asia/Singapore'); // Change to your time zone. $now = strtotime( 'now' ); $start = strtotime( 'September 8, 2021 12:00PM' ); // Change to your local start time. $end = strtotime( 'September 8, 2021 2:00PM' ); // Change to your local end time. $is_loadable = ( ( $now >= $start ) && ( $now <= $end ) ) ? 1 : 0; } return $is_loadable; } add_filter( 'pum_popup_is_loadable', 'schedule_my_popup', 2, 1000 );
View the source on GitHub.
The downsides to this option are:
- It suffers from the same issues as scheduling posts
- It's not feasible for a lot of popups (i.e., it doesn't scale up)
- Now you have to write, test, and maintain custom code
Learn more about adding custom PHP in our Getting Started with Custom PHP guide.
3) Use Popup Maker's Scheduling Extension #
If you need more scheduling features or need to schedule more than 1 popup, then our Scheduling extension is the best and most reliable choice.
Here's a sneak peek of the scheduling features you'll get with this extension.
Multiple types of schedules #
- Start Date: Schedule the popup to appear on a specified date & time.
- End Date: Stop the popup from appearing after a specified date & time.
- Date Range: Schedule popups for an entire date range.
- Chosen Dates: Choose specific dates to show the popup on.
- Office Hours: Choose specific days of the week, and set start & end times for those days.
- Multiple schedules: Add multiple schedules per popup using our scheduling interface.
- Schedule by Server Time: Have a promotion that starts or ends based on server time? Easily schedule your popups to sync up with those times.
- Schedule by Local Time: Use the Local Time Zone feature to deliver your popups according to the time zone of the user, not the time zone of your business.