WordPress.org

Ready to get started?Download WordPress

Forums

WP to Twitter
[resolved] [FEATURE REQUEST] addition of a #modified# tag (5 posts)

  1. MomDad
    Member
    Posted 2 years ago #

    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.

    http://wordpress.org/extend/plugins/wp-to-twitter/

  2. MomDad
    Member
    Posted 2 years ago #

    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.

  3. Joe Dolson
    Member
    Plugin Author

    Posted 2 years ago #

    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!

    Best,
    Joe

  4. MomDad
    Member
    Posted 2 years ago #

    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>

  5. Joe Dolson
    Member
    Plugin Author

    Posted 2 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic