Documentation Twitter and

Twitter and

Overview #

Twitter can be integrated in multiple ways with your VIP site:

  • Pushing out content updates.
  • Integrating Twitter updates in your site’s theme.
  • Providing your users a quick way to Tweet/share your site’s content.

↑ Top ↑ Publicize #

In addition to sending your content updates to Facebook and Yahoo!, the Publicize feature also supports Twitter updates. A full description of the feature can be found at the Publicize Support page. VIPs can further customize how Publicize works by following our customization guide.

↑ Top ↑

The Twitter Widget #

The Twitter widget allows you to display updates from a Twitter account in the sidebar of your blog. It creates an unordered list whose look and feel can be easily altered using CSS.

A full description of this widget can be found at the Twitter Widget Support page.

↑ Top ↑

/via in Tweets #

If you’re using the built-in Sharing buttons, we have a helper function to customize the “/via” tag appended to Tweets. Just add the following to your functions.php and change the argument to the username you want attributed.

wpcom_vip_sharing_twitter_via( 'automattic' );

If you want to disable the “/via”, just pass in false:

wpcom_vip_sharing_twitter_via( false );

↑ Top ↑

By default the Twitter sharing on will include the Twitter account @wordpressdotcom as a “related” account in the share link. After the resulting Tweet is posted, Twitter might then offer that related Twitter account as a suggested account to follow.

If you’d like to add additional Twitter accounts in front of the default, you can add a filter to your theme code:

add_filter( 'jetpack_sharing_twitter_related', function( $related, $post_id ) {
	$related = array(
		'@firsttwitteraccount' => 'A custom description here',
		'@secondtwitteraccount' => 'A second custom description here'
	return $related;

↑ Top ↑

Twitter Cards #

To automatically add Twitter Cards support for your site, just use our Open Graph Tags. We’ll add some additional metadata including some user-specific info if you’re using Publicize.

You can customize the output of the tags using the jetpack_open_graph_tags filter:

function my_add_twitter_card_extras( $tags ) {
	$tags[ 'twitter:site' ] = '@automattic'; // set @username of website
	return $tags;
add_filter( 'jetpack_open_graph_tags', 'my_add_twitter_card_extras' );

↑ Top ↑

The Twitter API #

Need to interact with the Twitter API? Check the WP Codebird library included in our Shared Libraries.