Embed a single Tweet with video in WordPress
The Twitter plugin for WordPress supports Twitter video embeds through the twitter_video
WordPress shortcode. Add an embedded video to a WordPress post by adding a shortcode to your WordPress post.
Example:
Check out this cool video: [twitter_video id="560070183650213889"] That was a cool video.
Shortcode result:
You can now shoot, edit and share video on Twitter. Capture life’s most moving moments from your perspective. pic.twitter.com/31JoMS50ha
— Twitter (@twitter) January 27, 2015
Supported shortcode parameters
The numerical ID of the desired Tweet.
Example Value: 560070183650213889
Set to false
, 0
, no
, or off
to directly link to the Tweet URL instead of displaying a Tweet overlay when the Twitter bird logo on the bottom corner of the video player is selected.
Example Value: false
Site-wide customization using a filter
A website may set site-wide preferences for Twitter hosted videos by acting on the associative array passed to the shortcode_atts_twitter_video
WordPress filter. Functions acting on the filter should set boolean literals when modifying value associated with the status
key.
Example:
/** * Always hide status overlay * * @param array $options parsed options with defaults applied * @param array $defaults default values of an embedded video * @param array $attributes user-defined shortcode attributes * * @return array options array with our customization applied */ function twitter_video_custom_options( $options, $defaults, $attributes ) { $options['status'] = false; return $options; } add_filter( 'shortcode_atts_twitter_video', 'twitter_video_custom_options', 10, 3 );