Support » Plugin: WP to Twitter » [Plugin: WP to Twitter] [FEATURE REQUEST] addition of a #modified# tag

  • Resolved MomDad


    I have a unique situation wherein individual posts are be programatically updated multiple times over the course of the same day, with each update being significant enough that it warrants being tweeted again as an update.

    However, with the current set of optional tags (#url#, #title#, #post#, #category#, #date#, etc.), it offers no means of making the tweet format unique if the update happens in the same day.

    When a post is updated and WP-to-Twitter attempts to tweet it again with the same format, Twitter sees it as a duplicate and flat-out ignores it.

    Up till now, I’ve been manually (re-)modifying your plugin to add in a “#modified#” tag, in order to allow such tweet formats as “Post updated #modified#: #title# #url#”, thereby avoiding Twitter ignoring it as a duplicate.

    The edit is simple, consisting only of a single line code addition to your jd_truncate_tweet() function:

    $post_sentence = str_ireplace( ‘#modified#’, date(‘Y-m-d h:iA e’), $post_sentence );

    and adding “#modified#” to the list of tags available. In my example, I’ve hardcoded the date format, but it should be fairly trivial, since you retrieve $post in the function, to alter it to use the post’s actual modified time and return it in the user-configured date & time formats — get_options(‘date_format’) and get_options(‘time_format’) — from the General > Settings page.

    So I’m here to propose this as a feature request; adding a “#modified#” tag to the other available options. This would allow greater flexibility for users with unique situations like mine, and save us the hassle of having to manually edit your plugin each time its updated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Sorry, that should be “posts are programmatically updated” — didn’t catch the mistakes until after my allotted edit time was up.

    I’m not sure that I explained it as well as I could, so to further what I said above, I should note that WP-to-Twitter is fine up until the point where there is a second update to the post. The initial post with the template as “New post: #title# #url#” is fine, the first update, using the default template is “Post updated: #title# #url#” is also fine. It’s at that point where things go awry if you have additional updates. If the post is updated yet again, and WP-to-Twitter is triggered, it attempts to tweet it with the same “Post updated: #title# #url#” template. Since it’s using the same format, there is nothing to uniquely separate the latest update from the previous as far as the tweet content itself is concerned, and Twitter ignores it as a duplicate. By adding in a #modified# tag — Post updated [#modified#]: #title# #url# — we have a new unique tweet in Twitter’s eyes, and it allows the tweet to go through.

    Plugin Author Joe Dolson


    It’s clear – I definitely understand it. You’re right, adding that wouldn’t be difficult – I’ll certainly get it in my to do list!


    Thanks so much for incorporating this feature into v2.4.5 — it works perfectly!

    I noticed one minor typo in wp-to-twitter-manager.php, it’s missing the 2nd “#” after “modified”:

    <li><?php _e("<code>#modified</code>: the post modified date", 'wp-to-twitter'); ?></li>

    Plugin Author Joe Dolson


    Whoops! Well, not a major issue…but I’ll take care of it.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: WP to Twitter] [FEATURE REQUEST] addition of a #modified# tag’ is closed to new replies.