There are users who absolutely hate buttons like
Feedburner buttons or Twittercounter buttons. Are you one of them? Do you want to display your twitter count as text, so it blends in to your new custom design? Well then this hack is just for you.
First you would need to create a file twitter.php and paste the following code in there:
02 | $tw = get_option( "twitterfollowerscount" ); |
03 | if ( $tw [ 'lastcheck' ] < ( mktime () – 3600 ) ) |
05 | $xml = file_get_contents ( 'http://twitter.com/users/show.xml?screen_name=wpbeginner' ); |
06 | if (preg_match( '/followers_count>(.*)</' , $xml , $match )!=0) { |
07 | $tw [ 'count' ] = $match [1]; |
09 | $tw [ 'lastcheck' ] = mktime (); |
10 | update_option( "twitterfollowerscount" , $tw ); |
Then Simply place this code anywhere you want to display this:
1 | <?php include ( "twitter.php" ); ?> |
No comments: