By @mhawksey

This week’s solutions: export twitter followers, auto anchors for WordPress and shortening urls in twitter badges

Thought I’d share some solutions I’ve found for problems I’ve encountered this week.
Problem: How to export a table (*.xls or *.csv) of twitter followers?
Solution: I first tried which was good because it didn’t ask for twitter account login details, but the results are limited to 100 entries. I then tried which did the job (but does require twitter username and password) Update: wrote a Google Spreadsheet to do this – I feel more secure using registering for my own Twitter API access
Problem: Adding anchors to WordPress blog?
Solution: This problem was asked by our e-learning accessibility expert, Craig Mill. He wanted to make some of his longer blog posts more accessible by having a table of contents at the top. The solution was very straight forward as MindWireMedia have created the Auto Anchor List plugin which does exactly what we were looking for. The plugin scans though posts and pages looking for headings, automatically creating a navigable contents list at the beginning of the post. To see it in action check out Craig’s e-Inclusion Blog
Long url problem on twitter badgeProblem: How to reformat long urls in twitter badges? We had a problem with urls in the @rsc_ne_scotland twitter badge which we use for News announcements on our site.
Solution: Using help from this how-to on Taco Quest and code from sevenofnine on I came up with the code below. If you would like to use it just grab this JavaScript file to replace ‘ blogger.js’ (this method of creating twitter badges has changed but here is an explanation for adding an old widget):

 function twitterCallback2(twitters) {
    var statusHTML = [];
    for (var i = 0; i & lt; twitters.length; i++) {
        var username = twitters[i].user.screen_name;
        var status = twitters[i].text.replace(/((https?|s?ftp|ssh)\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/g, function (url) {
            var lm = 28;
            var strD = url.split("");
            var strB = "";
            var strT = "";
            var breakChar = "...";
            for (var i = 0; i & lt; strD.length; i++) {
                strB += strD[i];
                if (strB.length & gt; = lm) {
                    strT += strB + breakChar;
                    strB = "";
            if (strD.length & lt; lm) {
                strT = url;
            return '<a href="' + url + '">' + strT + '</a>';
        }).replace(/\B@([_a-z0-9]+)/ig, function (reply) {
            return  reply.charAt(0) + '<a href="' + reply.substring(1) + '">' + reply.substring(1) + '</a>';
        statusHTML.push('<li><span>' + status + '</span><br/><a style="font-size:85%" href="' + username + '/statuses/' + twitters[i].id + '">' + relative_time(twitters[i].created_at) + '</a></li>');
    document.getElementById('twitter_update_list').innerHTML = statusHTML.join('');
Exit mobile version