Custom Scheduling in WP Tweets PRO

WP to Twitter is a simple plug-in — publish your post, send out a Tweet.

WP Tweets PRO makes that a bit more sophisticated: publish your post, send out the Tweet a few minutes later and schedule a couple additional Tweets for points in the future.

But it’s still straightforward – WP Tweets PRO gives you a setting to determine intervals. You can have your post Tweeted 10 minutes after publication, then you can set an interval (say, 13 hours), and have it re-Tweeted every 13 hours after that initial Tweet.

If you’re using the ‘Blackout’ period, Tweeting your posts is a bit more enriched: re-Tweet that post every 13 hours, but if one of those Tweets falls between midnight and 6am, shift it a bit later, so it falls during a better period for you.

This can be a great way of helping your content to reach new audiences — audiences that are using Twitter at different times or in different places, while avoiding those quiet times when your followers aren’t online.

That’s awesome. So what’s the problem?

But what if you want something more sophisticated? You know your audiences better than anybody else, and you may have some specific needs for delaying your Tweets.

Well, WP Tweets PRO has a filter that will be very useful to you – it’s the wpt_schedule_retweet filter.

The filter is run when WP Tweets PRO schedules your re-Tweeted posts.

All it returns is a delay in seconds: the amount of time after the original Tweet is sent that the new Tweet should be sent. It takes three additional arguments: the account ID of the user who’s Twitter account is being used, the retweet ID (whether it’s the first, second, or third retweet of this post), and an array of post information.

You can use any of this information to decide on a delay; but probably the simplest is the re-Tweet ID. Knowing which re-Tweet is which gives you a simple way to adjust the time frames to something with an unequal interval.

Let’s say you want to publish the first re-Tweet after 12 hours, the second after 48 hours, and the third after a week, to stagger your Tweets.

Here’s your filter: (which you would place in your theme’s functions.php file.)


add_filter( 'wpt_schedule_retweet', 'my_retweet_schedule', 10, 4 );
function my_retweet_schedule( $time, $acct, $rt, $post ) {
     $hour = 60 * 60;
     $rt1 = 12 * $hour; // first re-Tweet out 12 hours
     $rt2 = 48 * $hour; // second re-Tweet out 48 hours
     $rt3 = 168 * $hour; // third re-Tweet out 168 hours
     switch ( $rt ) {
          case 1: return $rt1; break;
          case 2: return $rt2; break;
          case 3: return $rt3; break;
     }
     return $time;
}

All this code does is shift the re-Tweeting schedule so that the re-Tweets go out when you want them to.

Want to use this code? Go ahead — all you need to change is the number of hours each post is scheduled to go out for, and otherwise you can just drop it in. Of course, you need to Buy WP Tweets PRO, first.

Have something to contribute?




« Read my Comment Policy

Start the conversation!

Return to Top