How can I show my scheduled posts in Google Calendar?
It’s not Google Calendar, but the Editorial Calendar plugin works really nicely.
It’s not Google Calendar, but the Editorial Calendar plugin works really nicely.
If you want to display the scheduled posts in the main wordpress loop you can use ‘post_status’ => ‘future’ as an argument for the array. This will now show your scheduled posts for all users. It’s pretty handy for things like event listings. However there is a problem with this and I believe this is … Read more
You can use the WordPress Cron functionality to schedule a cron job every hour. The only thing you need to hold in mind is that the WordPress cron works different than a normal cron. The action will trigger when someone visits your WordPress site, if the scheduled time has passed. https://codex.wordpress.org/Function_Reference/wp_schedule_event <?php // Schedules the … Read more
I found my answer while searching over other stackoverflow answers below is the code what I’ve added. $postdate = date(‘Y-m-d H:i:s’,strtotime(‘+20 minutes’)); $postdate_gmt = gmdate(‘Y-m-d H:i:s’,strtotime($postdate)); $post = array( ‘post_date_gmt’ => $postdate_gmt, ‘post_date’ => $postdate, ‘edit_date’ => ‘true’ );
A much cleaner solution is to just set the post status via pre_get_posts. By default, the main query only shows published posts to logged out users and published and private posts to logged in users. We can add future posts to main query with pre_get_posts add_action( ‘pre_get_posts’, function ( $q ) { if ( !is_admin() … Read more
Added the following to my theme’s functions.php: define(‘WPMS_DELAY’, 5); // Run the below cron task every X minutes define(‘WPMS_OPTION’, ‘wp_missed_schedule’); function wpms_replacements_deactivate() { delete_option(WPMS_OPTION); } register_deactivation_hook(__FILE__, ‘wpms_replacements_deactivate’); // Run the following code on every request function wpms_init() { remove_action(‘publish_future_post’, ‘check_and_publish_future_post’); $last = get_option(WPMS_OPTION, false); // Exit here if less than WPMS_DELAY minutes has passed since … Read more
If you made your special offers a custom post type you could set the ‘scheduled’ date to the day you wanted it to expire then use this code to auto publish it on schedule after you’ve changed the scheduled date. The ‘future_show’ line goes with my ‘show’ custom post type so if you had a … Read more
The plugin Automatic Post Date Filler suggested in the comments is a perfect solution. Even better than imagined with all the various preferences to how it dynamically sets up the defaults when you edit the scheduled time.
My approach is to create an hourly cron event that loops through all the draft status posts and checks for the publish month – date and hour saved in post_meta and publishes if scheduled date is not in the future. A publish date and time select meta box is added to the publishing div that … Read more