Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 123
Follow Button
The Twitter plugin for WordPress supports adding a follow button to your site through a WordPress widget, pasting a Twitter profile URL into post content, or through the twitter_followWordPress shortcode. Add a Follow button to a WordPress post by including the shortcode in
your post content area or by evaluating a shortcode in PHP using the do_shortcode WordPress function.
Add a follow button to a WordPress post by copy-and-pasting a Twitter profile URL on its own line in the post content area.
I post updates on Twitter. https://twitter.com/TwitterDev Follow my account to receive updates.
Example:
Follow us on Twitter: [twitter_follow screen_name="TwitterDev"]
| Attribute | Description | Example |
|---|---|---|
| screen_name | Twitter username of the account to follow. | TwitterDev |
| show_screen_name | Set to false, 0, no, or off to remove the Twitter username from the displayed button. | false |
| show_count | Set to false, 0, no, or off to remove the number of followers for the specified account alongside the button. | false |
| size | Set to large to display a larger version of the follow button. | large |
A website may set site-wide preferences for Follow buttons by acting on the associative array passed to the shortcode_atts_twitter_followWordPress filter. Functions acting on the filter should set boolean literals when modifying show_count or show_screen_name values.
Example:
/** * Always show large button * * @param array $options parsed options with defaults applied * @param array $defaults default values of a Follow button * @param array $attributes user-defined shortcode attributes * * @return array options array with our customization applied */functiontwitter_follow_custom_options( $options, $defaults, $attributes )
{
$options['size'] = 'large';
return$options;
}
add_filter( 'shortcode_atts_twitter_follow', 'twitter_follow_custom_options', 10, 3 );