WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Twitter Widget Pro] Length of Follow icon

[Plugin: Twitter Widget Pro] Length of Follow icon

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Aaron D. Campbell
    Participant

    @aaroncampbell

    Unfortunately that’s something that Twitter embeds. We do however have some limited control over it and here are the parts that might help:

    • We can tell it not to show the follower count
    • We can tell it not to show the username
    • We can give a suggested width. This is not strictly enforced, but Twitter *tries* to make the button fit in that width

    You can use any or all of these. Here is some sample code that you can drop into a plugin or your theme’s functions.php file that shows how to do all three:

    function bd_hide_follower_count( $attributes ) {
    	if ( ! empty( $attributes['class'] ) && 'twitter-follow-button' == $attributes['class'] )
    		$attributes['data-show-count'] = 'false';
    		//$attributes['data-show-screen-name'] = 'false';
    		$attributes['data-width'] = '138px';
    
    	return $attributes;
    }
    add_filter( 'widget_twitter_link_attributes', 'bd_hide_follower_count' );

    Basically all links that Twitter Widget Pro creates are built using a function and have filters set up so you can adjust them. In this case we are only changing the follow button, and we’re adding a couple additional attributes (see https://dev.twitter.com/docs/follow-button to understand exactly what they do).

    ginez_17
    Participant

    @ginez_17

    Thank you very much. Very helpful.

    very handy. thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Twitter Widget Pro] Length of Follow icon’ is closed to new replies.