Rotating Tweets (Twitter widget and shortcode)

Rotating Tweets (Twitter widget and shortcode) | Martin Tod

Description

  • Replaces a shortcode such as [rotatingtweets screen_name='your_twitter'], or a widget, with a rotating display of your most recent tweets
  • Supports the new longer tweet format
  • Supports 280 characters
  • Space efficient – instead of showing all your tweets at once, shows one at a time and then smoothly replaces it with the next one. After showing all your tweets, loops back to the beginning again.
  • Reliable – keeps showing your latest Tweets even if the Twitter website is down.
  • Customizable – you decide whose tweets to show, how many to show, whether to include retweets and replies, and whether to show a follow button. You can also decide how quickly the tweets rotate and what type of animation to use.
  • Responsive – resizes as your page resizes
  • GDPR-friendly – with default settings, collects no user data and shares no user data (including IP addresses) with anyone else. Supports ‘Do Not Track’ (DNT).
  • Gives you the option to show a fully customizable Twitter ‘follow’ button. For note, because of the way Twitter’s code for the Twitter button works, the button will display as a regular text link to site visitors who have set ‘Do Not Track’.
  • Replaces t.co links with the original link
  • Caches the most recent data from Twitter to avoid problems with rate limiting
  • Uses jQuery, jQuery.Cycle and jQuery.Cycle2 to produce a nice smooth result.
  • Compatible with W3 Total Cache.
  • Multi-lingual – now set up to be multi-lingual. The Twitter ‘follow’ button is automatically translated to match your site’s language setting if Twitter has made the appropriate language available. Also uses WordPress’s multi-lingual capability to enable translation of all the other text used by the plug-in via language packs.

If you’d like to see what the plug-in looks like in action, you can see the plug-in working here.

Credits

Most of this is my own work, but special thanks are owed to:

Thank you to the people who did the original translation work for the following packs:

  • Wilmerson Felipe for his work on Brazilian Portuguese
  • Nils Kroneberg for his work on German
  • Alberto Lario for his work on Spanish
  • Mattia Migliorini at deshack for his work on Italian
  • Natasja Weijer for her work on Dutch
  • Alexandre Trudel for his help on French
  • Borisa Djuraskovic at Web Hosting Hub for his help on Serbian

Installation

Installation

  1. Upload the contents of rotatingtweets.zip to the /wp-content/plugins/ directory or use the WordPress installer
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Go to the My applications page on the Twitter website to set up your website as a new Twitter ‘application’. You may need to log-in using your Twitter user name and password.
  4. If you don’t already have a suitable ‘application’ to use for your website, set one up on the Create an Application page. It’s normally best to use the name, description and website URL of the website where you plan to use Rotating Tweets. You don’t need a Callback URL.
  5. After clicking Create your Twitter application, on the following page, click on Create my access token.
  6. Copy the Consumer key, Consumer secret, Access token and Access token secret from your Twitter application page into the Rotating Tweets settings page. Hit save. If there is a problem, you will see an error message.
  7. Place a shortcode such [rotatingtweets screen_name='mpntod'] in your post or page, or use a widget

Set-up

Options include:

  1. Going to the Widgets menu on the admin page and adding the Rotating Tweets widget. Options include the name of the Twitter account to show, whether to show retweets and the speed of rotation.
  2. Using the basic Rotating Tweets shortcode, for example [rotatingtweets screen_name='mpntod']
  3. Using a more complicated Rotating Tweets shortcode, for example [rotatingtweets screen_name='mpntod' include_rts='1' tweet_count='7' timeout='3000']

Shortcode variables

Possible variables for the shortcode include:

  • Required settings – at least one of the following three settings is required for the short-code to function:

    • screen_name = one or more Twitter user names e.g. [rotatingtweets screen_name="mpntod"] or [rotatingtweets screen_name="mpntod twitter"]
    • url = Twitter user URL. If screen_name is empty and this link is valid, screen_name will be set to the user name included in url
    • search = a term to search for. There’s a useful guide to using Twitter’s search function at https://support.twitter.com/articles/71577-using-advanced-search
  • Twitter options

    • include_rts = '0' or '1' – include retweets – default is '0'
    • only_rts = '0' or '1' – only include retweets – default is '0'
    • exclude_replies = '0' or '1' – exclude replies – default is '0'
    • tweet_count = number of tweets to show – default is 5
    • get_favorites = '0' or '1' – show someone’s favorites rather than their timeline – default is '0'
    • list = 'list-slug' – the ‘slug’ used by someone’s list (something like my-list)
    • offset = ”number” – default is '0' – enables you to start on a later tweet – '1' starts on the 2nd tweet, '2' starts on the 3rd tweet, etc.
  • Display options

    • official_format = '1', '2' or 'custom' – show one of the two official formats or a custom format if you have written your own rotatingtweets_display_override() function – default is '0'
    • rtw_display_order='info,main,media,meta' – change the order that the main elements of the tweet are shown – info, main, media and meta – via a string using the four keywords separated by commas – default is 'info,main,media,meta'
    • timeout = time that each tweet is shown in milliseconds – default is '4000' (i.e. 4 seconds). timeout=0 allows for continuous scrolling.
    • speed = time it takes to change from one tweet to the next in milliseconds – default is '1000' (i.e. 1 second)
    • links_in_new_window = '0' or '1' – show links in a new tab or window – default is '0'
    • rotation_type = If you are using version 1 of the JavaScript, you can use any of the options listed on the jQuery.cycle website – default is 'scrollUp'. If you are using version 2 of the JavaScript, then the options are 'scrollUp','scrollDown','scrollHorz','scrollLeft','scrollRight','toss','scrollVert','fade' and 'carousel'

      • carousel_horizontal = 0 or 1 – if you’ve chosen ‘carousel’ as a rotation type, allow horizontal scrolling – default is 0
      • carousel_count = ”number” – if you’ve chosen ‘carousel’ as a rotation type, set the number of slides to appear in the carousel – default is 3 for vertical carousel and enough to fill the width of the page for horizontal carousel
      • carousel_responsive = 0 or 1 – if you’ve chosen a ‘horizontal carousel’ as a rotation type, makes the carousel responsive to the size of the page – default is 0
    • url_length = sets the length that the URL of links should be trimmed to… – optional
    • show_tco_link = '0' or '1' allows you to show Twitter’s t.co link instead of the original link – optional
    • show_meta_timestamp = '0' or '1' – show the time and date of each tweet – default is '1'
    • show_meta_screen_name = '0' or '1' – show who posted each tweet – default is '1'
    • show_meta_via = '0' or '1' – show how each tweet was posted – default is '1'
    • show_meta_reply_retweet_favorite = '0' or '1' – show ‘reply’, ‘retweet’ and ‘favorite’ buttons – default is '0'
    • no_rotate = '0' or '1' – switch off rotation – default is '0'
    • show_meta_prev_next = '0' or '1' – show ‘next’, ‘prev’ links – default is '0'

      • prev = content for the prev button (default 'prev')
      • next = content for the next button (default 'next')
      • middot = content for the space between the buttons (default ' · ')
      • np_pos = position for ‘next’ and ‘prev’ buttons – 'top', 'bottom', 'insidebottom', 'beforeafter' or 'tweets' (default 'top')
    • show_meta_pager = '0' or '1' – show pager blobs below the tweets – default is '0'
    • show_meta_pager_blob = content for your pager blob – default is '<a href="#">&bull;</a>'
    • show_media = '0' or '1' – experimental option that shows images with the tweet – default is '0'
    • screen_name_plural = '0' or '1' – experimental option that allows you to have a plural possessive in the default display format (e.g. British Lions’ Twitter) – default is '0'
    • tweet_length = maximum number of characters to show in tweet – default is '0' which allows whole tweet to be shown
    • no_emoji = '0' or '1' – experimental option that removes emoji from the feed – default is '0'
    • official_format_override = '0' or '1' – enables you to change the settings for show_meta_reply_retweet_favorite and show_meta_timestamp on the ‘official formats’.
    • profile_image_size = 'normal', 'bigger', 'mini' or 'original' – lets you change the size of profile images – default is 'normal'
    • shuffle = '0' or '1' – shuffle the order that Tweets display – default is '0'
    • merge_cache = '0' or '1' – switches caching of searches on or off – default is '1' (i.e. on)
    • auto_height = '0' or '1' – switches auto-height calculation of the Rotating Tweets container on or off – default is '1' (i.e. on)
    • show_line_breaks = '0' or '1' – displays line breaks in the tweet – default is '0' (i.e. off)
  • Caching

    • w3tc_render_to = ‘your_choice_of_random_string’ – used to support ‘fragment caching’ by W3 Total Cache. For this to work, you also need to ensure that W3TC_DYNAMIC_SECURITY is defined in your wp-config.php file and that you are not using ‘HTTP Compression’ on the W3 Total Cache ‘Browser Cache’ settings page or ‘Enhanced Disk caching’ on the W3 Total Cache ‘Page Cache’ settings page.
  • Twitter follow button

    • show_follow = '0' or '1' – show follow button – default is '0'
    • no_show_count = '0' or '1' – remove the follower count from the Twitter follow button – default is '0'
    • no_show_screen_name = '0' or '1' – remove the screen name from the Twitter follow button – default is '0'
    • large_follow_button = '0' or '1' – show a large Twitter follow button – default is '0'

Plugin author

Martin Tod

Plugin official website address

https://wordpress.org/plugins/rotatingtweets/
If you encounter problems in using the Rotating Tweets (Twitter widget and shortcode) plugin, you can comment below, and I will try my best to help you solve the problem

Leave a Comment

Your email address will not be published.