Fix for wordpress twitter widget not loading on mobile devices

twitter-widget-mobile (iPhones, Android, Blackberry… etc.)

On mobile devices, we noticed our twitter widgets weren’t loading. This problem is caused because twitter.com automatically forwards mobile devices to mobile.twitter.com

Since the “twitter-widget.php” file links to the source file “http://twitter.com/javascripts/blogger.js”, on mobile devices it will link to a file that does not exist, resulting in the following error:

“Failed to load resource: the server responded with a status of 404 (Not Found) | mobile.twitter.com/javascripts/blogger.js”

The solution for this is to host your own blogger.js file:

1. Download/Save blogger.js and upload to your website under:
wp-content/themes/YOUR_THEME/javascript/blogger.js

2. Change one line of twitter-widget.php:
/wp-content/themes/XXXXX/include/plugin/custom-widget/twitter-widget.php (This plugin came packaged in the theme)

Find this line

[sourcecode language=”php”]
<script type=”text/javascript” src=”http://twitter.com/javascripts/blogger.js”></script>
[/sourcecode]

Change it to this

[sourcecode language=”php”]
<script type=”text/javascript” src=”http://YOUR_WEBSITE.com/wp-content/themes/YOUR_THEME/javascript/blogger.js”></script>
[/sourcecode]

How Can We Help?