Embedded List Timeline

Ben Ward edited this page Dec 11, 2017 · 1 revision

The Twitter plugin for WordPress supports embedding the latest Tweets from a list of Twitter accounts by pasting a Twitter list URL into the WordPress post editor or by customizing a [twitter_list] WordPress shortcode. WordPress users capable of editing themes may add a Twitter list to a theme's widget area through the WordPress widget editor.

Embed using a Twitter list URL

Add an embedded list timeline to a WordPress post by copy-and-pasting a Twitter list URL on its own line in the post content area.

People currently floating through space

https://twitter.com/NASA/lists/astronauts-in-space-now

Sharing experiments and views from above.

The Twitter plugin for WordPress extends the oEmbed functionality for Twitter list URLs available since WordPress 4.7 with additional plugin-specific functionality. URL-based embeds pass through the plugin's shortcode handler for site-wide customization of parameters. JavaScript normally returned in an oEmbed response is enqueued through the WordPress resource manager, improving site performance while centralizing customizations.

Embed using a shortcode

The Twitter plugin for WordPress registers the twitter_list shortcode handler to allow customization of an embedded list timeline through a shortcode macro.

People currently floating through space

[twitter_list screen_name="NASA" slug="astronauts-in-space-now" height="400"]

Sharing experiments and views from above.

Supported shortcode parameters

Attribute Description Example
screen_name The Twitter username of the list owner NASA
slug The unique name of the list. Appears as the final path component of the list URL astronauts-in-space-now
width Set the maximum width of the timeline in whole pixels 500
height Set a fixed height of the timeline in whole pixels 400
limit Display a static timeline expanded to up to N Tweets. The height attribute has no effect when a limit is specified 5
chrome Toggle the display of design elements in the widget with comma-separated tokens. Accepted tokens: noheader, nofooter, noborders, noscrollbar, transparent noheader,nofooter
aria_polite Set the ARIA politeness of the timeline live region as new Tweets are added assertive
theme Set a light or dark widget background Overrides the site-wide value set through the plugin settings page dark
link_color Adjust the hexadecimal color of links, including hashtags and @mentions, inside each Tweet. Overrides the site-wide value set through the plugin settings page 21759b
border_color Adjust the hexadecimal color of borders between Tweets. Overrides the site-wide value set through the plugin settings page d54e21

Site-wide customization using a filter

A website may set site-wide preferences for list timelines by acting on the associative array passed to the shortcode_atts_twitter_list WordPress filter. Functions acting on the filter should set a decimal integer when modifying the value of the width, height, or limit key.

Example:


/**
 * Always display a timeline at a height of 400 pixels
 *
 * @param array $out        Parsed user-defined valid attributes or default attribute value
 * @param array $pairs      supported attributes and their default values
 * @param array $attributes user-defined attributes in the shortcode tag
 *
 * @return array options array with our customization applied
 */
function timeline_custom_options( $out, $pairs, $attributes )
{
  $out['height'] = 400;
  return $out;
}
add_filter( 'shortcode_atts_twitter_list', 'timeline_custom_options', 10, 3 );
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.