WordPress.org

Ready to get started?Download WordPress

Forums

Twitter Widget Pro
[resolved] I want to remove the number of followers box (10 posts)

  1. Lock-N-Load
    Member
    Posted 1 year ago #

    Is it possible, in editing the plugins code, to keep the Follow button but remove the number of followers box that floats off to the right?

    My clients user name is long and so with that number of followers box it gets cut off so I just want to remove the number of followers box but keep the Follow button.

    What lines of code would I need to edit?

    http://wordpress.org/extend/plugins/twitter-widget-pro/

  2. konehead
    Member
    Posted 1 year ago #

    Yes! I would too.
    I did discover, via Firebug, this class below will hide the number of followers:

    .count-ready .count-o {
      visibility: hidden;
    }

    The problem is, it is so buried in the CSS I am not sure I am targeting it correctly.

    Any ideas?

  3. Lock-N-Load
    Member
    Posted 1 year ago #

    I attempted to put it into the php file wp-twitter-widget.php

    <style type="text/css">
    .count-ready .count-o {
    visibility: hidden;
    }
    </style>

    but it did not hide that box. I also put it into the main themes style sheet, it idid not either. this kind of tells me, those styles are not related to this and even looking at the code of the plugin, I don't even see these.

    Not sure where you even found that the those are the styles associated with that box? Viewing the source and code does not indicate that.

  4. Rootside
    Member
    Posted 1 year ago #

    It’s not working because the follow button and the follower count are sitting in an iframe populated by Twitter. This section is basically a tiny website inside your website – the code isn’t coming from the plugin, it’s hosted on Twitter’s server. You can’t target it with CSS from your site, at least not directly.

    The easiest option is to switch off the follow button altogether.

    Displaying the follow button without the follower count would have to be managed via a setting in the plugin. Maybe that’s on the list for a future version – or it might be if enough people ask for it.

  5. Lock-N-Load
    Member
    Posted 1 year ago #

    Yeah, if it is in an iframe, and both the follow button and likes # box are in it, there is no immediate fix then one could hack with code like the above attempted CSS tactic since we cannot get acces to the iframe contents as the setting in the plugin likely just hides the iframe.

    This really should be a part of the plugin. My reason for wanting it alone is a valid one, but another valid one is what if people have so few followers, it might be embarrassing to have a little box floating there that says "5".

  6. Lock-N-Load
    Member
    Posted 1 year ago #

    I ended up just recoding the margins of the footer column that hold this widget so that the annoying "followers" number box does not run over into the next footer item but we still get to keep the "follow me" button.

    That # box really needs to be a seperate on/off item from the follow me button.

    And what is funny, look at the bottom of this page.. see the very same "Follow @WordPress" button? But yet it has no # box to it's right. That is the same button used in this widget and yet somehow, down below, the # box is not showing. Proof it can be done.

  7. Lock-N-Load
    Member
    Posted 1 year ago #

    I figured another way you could do this using this Twitter dev page https://dev.twitter.com/docs/follow-button#followers-count-display

    You "could" turn the Follow button off in the widget as that is a setting you can do in this widget and then you could add another widget of just script code below this widget and use the iFrame script code and style it how you wish. That way, the follow button would be below this widget styled any way you like.

  8. Lock-N-Load
    Member
    Posted 1 year ago #

    It seems the code at play here for that "follower count display is" box is

    show_count=true or data-show-count=true

    I see neither of these variables in the widgets editable code.

    Now I did see, on line 818

    private function _getFeedUrl( $widgetOptions, $type = 'json', $count = true ) {

    and so I set $count = false which did not work and I would think it should have given this line of comment above that at line 815 are

    @param bool[optional] $count - If true, it adds the count parameter to the URL

  9. Aaron D. Campbell
    Member
    Plugin Author

    Posted 1 year ago #

    Actually, there has been code posted in several places on this forum to show how to do that. Here's a couple examples:
    http://wordpress.org/support/topic/hide-follow-username-and-followers-on-widget
    http://wordpress.org/support/topic/plugin-twitter-widget-pro-hide-counter

    Here's info about what parameters the follow link can use: https://dev.twitter.com/docs/follow-button

    You can adjust what parameters are passed by adding code like this to another plugin or to your theme's functions.php file:

    function range_hide_follower_count( $attributes ) {
    	if ( ! empty( $attributes['class'] ) && 'twitter-follow-button' == $attributes['class'] )
    		$attributes['data-show-count'] = 'false';
    
    	return $attributes;
    }
    add_filter( 'widget_twitter_link_attributes', 'range_hide_follower_count' );
  10. Lock-N-Load
    Member
    Posted 1 year ago #

    thanks.. sorry I missed those threads

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags