Creating a Custom jQuery Twitter Feed (API v1.1)

15 December, 2012 by Tom Elliott

This is comment page 3 for Creating a Custom jQuery Twitter Feed (API v1.1) »


Authenticating a Twitter Feed for OAuth API V1.1 – Timelines & streams »
Twitter feed authentication (API 1.1) for search »
Creating a Twitter Search & Analytics tool »


510 Comments

  • Matt H says:

    Hi Tom, apologies me again. Reading back through some of the posts I’ve removed www. from the $.getJSON and the tweets load…but again I get a weird object error. Let me know if you have any ideas what the problem may be 🙁 Thanks once again.

    • Tom Elliott says:

      Hi Matt, just had a look and seems like things are working now? 🙂

      • Matt H says:

        Hi Tom, Everything is working perfectly 🙂 Thanks so much for your help. I have often tried to contact people regarding tutorials and I can genuinely say that you are one of the few people to respond and so swiftly!

        After investigating I realised when I created the wordpress staging website my site urls in wp-admin settings had lost www. and this is why the $.getJSON call was failing. Cheers 🙂

  • Matt Harris says:

    I am having a weird issue. I keep getting a popup that says:

    “parsererror – SyntaxError: JSON.parse: unexpected character”

    and I cannot find the source of the problem. Any suggestions? I am building the site at the following address: new.semoelite.com

  • Matt H. says:

    Hey I got my script working with my site. Now I have another question. How hard would it be to incorporate jcarousel lite into the .js file and make the tweets auto scroll?

  • stunomatic says:

    http://www.helplostpet.com/

    Please check below link I Used your toturial and I think I’m also done but getting a popup error :/ don’t know why will you please check tell me my mistake.

    Thanks and really great work

    • Tom Elliott says:

      Hey there, it’s a cross-domain error as your trying to access the tweet file from non-www. If you change your $.getJSON request to your get tweets php file, it should work 🙂

  • Craig says:

    Hi Tom,

    I’ve got everything working and the tweets displaying now, except I’m getting some strange jQuery error. The error message is this:

    “object Object],[object Object],….,[object Object],[object Object]”

    Every time I refresh the page it pops up. Could you help me out please?

    Many thanks.

  • Keisa says:

    Hello Tom I recently posted on another post and mentioned that my get-tweets1.1.php wasn’t displaying tweets in json format.

    Thanks to you I ended up getting it to work
    Screenshot here//
    http://i44.tinypic.com/281zexu.png

    My new issue is the tweets on my website aren’t displayed at all. I viewed the source code and the “twitter-feed” div is there but empty…

    I have twitterfeed.js & twitterfeed.css in my header//
    http://i39.tinypic.com/dbasz.png

    and changed both:
    twitterprofile = “keihead”;
    screenname = “keihead”;
    as well as the $getJSON url to//
    example[dot]com/test/get-tweets1.1.php

    but as I said before the div remains empty…

    Please help me get this working >.<

    • Tom Elliott says:

      Hey Keisa, are you getting a JavaScript error? Usually that points to the problem and you can use Chrome or FireFox console to see this. It could be a parsing error or path issue for example. If you can send me a link I could help further? I won’t publish the web address.

    • Tom Elliott says:

      Hi Keisa, thanks for the link. It’s like the JS is being ignored for some reason. Usually it generates the HTML for the twitter feed error before trying to parse the tweets and it’s not doing that. Looking at the twitter feed JS, it looks like it’s being minified but it a way I haven’t seen before so I’m not sure if any of the structure is broken. I would be tempted to try and test the twitter feed on it’s own on a new page without WordPress or any plugins that may be altering the structure of the JS

  • Marius says:

    Hi Tom,

    Thanks for this very nice tutorial!

    Unfortunately I get a ‘No Transport’-error when I upload the Twitter feed to the hosting company of my client. Locally on my Qnap NAS webserver it works fine.

    I found that the ‘No Transfer’-error has to do with cross domain boundaries and that I should use JSONP in stead of JSON. I’ve added a callback function to the connection->get statement, but that didn;t work.
    I’ve also tried to set jQuery.support.cors = true; to allow cross domain browsing, but then I got something like ‘Not Allowed’.

    Can you help me with this?

    I’ve added an absolute path to get-tweets1.1.php in twitterfeed.js and a correct relative path to twitteroauth.php. I looked at you troubleshooting tips and I’m quite sure I’ve done everything as it should.

    Thanks in advance!

    • Marius says:

      Tom, I saw your comment about using the console in Chrome and I found that I was using an inccorrect absloute path. I should not have used the www

      Now, I have an invalid character error, so I’m looking further into it 🙂

  • Marius says:

    Hi Tom,

    I still have the unexpected character (in Chrome it says parsererror – SyntaxError: Unexpected token <) and I cannot find the culprit. I have no extra HTML in my get tweets php, I just copied your version of it.

    Can you help me? The site I'm working on is http://www.disis.nl

    Thanks in advance!

  • Dominick says:

    i got you code to work. the php files gets all my tweets, but the container shows only one tweet. i have not changed anything

  • Dominick says:

    I can only see one tweet. why is that. i have the php file with all my tweets in jSOn format

    • Tom Elliott says:

      Hi Dominick, this could be happening if most of your tweets are direct replies or retweets which may be disabled in your twitter feed JS. I’d try increasing the number of tweets from your get PHP file but if this is still not working, feel free to send me a link

  • Richard says:

    Hi Tom, awesome app and just what I needed after Twitter pulled the plug on the older api.

    Ive got it all working, but I am having one small issue, I can get the Tweet, retweet and favourite icons to appear… it kind jerks like its going to but then nothing? Any idea what I have done wrong, cause everything looks good to me.

    You can see the issue here: http://tanisharose.com/Twitter

    Many thanks in advance for any help

    • Tom Elliott says:

      Hi Richard, thanks and cheers for pointing out this bug. Looks like I accidentally restored a slightly older version of the CSS in the post. In the Twitter feed CSS, try removing the line display:none; from the .intent class around line 100 which should fix it?

      • Richard says:

        Hi Tom,

        That did the trick, but oddly, the icons are visible upon load, they only disappear when you hover over them. Not sure that’s right is it?

        Have a look and see what I mean, and thank you for such a quick reply.

        http://tanisharose.com/Twitter

        • Tom Elliott says:

          Hi Richard, ah yes, my mistake – the id #twitter-actions in the twitter CSS should now have display:none; style added as well

          • Richard says:

            Spot on, done and sorted, Thank you 🙂

            I’ll get this ported to the main sight today

            Thanks again!

          • Richard says:

            Hi Tom,

            just had a thought, is there anyway to make the tweets scroll in a ticker fashion vertically? So for instance only 3 tweets will be displayed at any one time, but upon load you are shown the most recent tweet and then after, say 5 second intervals, older tweets come into view? As this uses JQuery, i’m guessing the animate function could be used?

          • Tom Elliott says:

            Hi Richard, yeah – it wouldn’t be too hard to modify to have a scrolling tweet list as you suggested. I’ve been meaning to do this kind of animation but not quite got round to it yet! 😉

          • Richard says:

            Hi Tom, that is good news, I’m no JS programmer so i’ll have to wait for you to implement that feature. Am however having a small issue. I am using the feed on a responsive website and have tried to use percentages for the .twitter-article, #loading-container divs, but changing this causes the text not to wrap around the image and also the text gets chopped off by the container div.

            I have reset .twitter-article, #loading-container back to pixels in the below example, to show you what happens if you resizes the browser window, is there any way to stop the clipping of content happening?

            http://tanisharose.com/beta

            This one has me stumped.

          • Tom Elliott says:

            Hi Richard. Ah, yes – a bit more tricky to get this responsive. I’ve tried the following on your link and seems like it could work:
            – change .twitter-article to width 110%
            – change .twitter-text to a width of 62%
            You might need to mess around with the values and turn off overflow:auto on the #twitter-feed but hope that helps 🙂

          • Richard says:

            Thanks Tom, I know changing the .twitter-text to a percentage always pushed the text to below the image, so hopefully i can figure out a work around. i’ll have a play around and report back.

            Cheers

          • Richard says:

            Hi Tom

            I got everything working in the end, had to make quite a few changes in the twitterfeed.js to the HTML sections, especially for controlling the Profile icon… my way provides you with more control over the image positioning and styling – your milage may vary. Also a few updates to the CSS file as well, but all in all, working well and is now live here:

            http://tanisharose.com

            If you ever add the ticker scrolling, let me know, would love to get that in there.

            Thanks again for the help and an excellent use for the new twitter API v1.1

          • Tom Elliott says:

            Hi Richard, great, looks like you’ve done a good job making the twitter feed width responsive! Will let you know on any updates regarding feed animations 🙂

  • Tom Elliott says:

    Hi Regil, yes – looks like your twitter feed is on the non-www but your calling the php in your twitter feed JS using the www. Try changing your getJSON path in the JS to http://yoursite.com/pathtotwitterfeed (without the www)

    • Regil says:

      Hi Tom,

      Thank you for the quick response.. i already fixed it i just added this code to my get-tweets.php
      ” header(‘Access-Control-Allow-Origin: *’); ” ..and it work.. but I’ve got another problem the tweet-actions buttons are not visible when hove.. thank you Tom for the awesome plugins/app.. 😀

      • Tom Elliott says:

        Hi Regil, thanks. Yeah – a small CSS issue as I changed something today… check out this comment 🙂

        • Regil says:

          Hello Tom the buttons are now working great.. but the twitter plugin dont work on internet explorer.. an alert message pop and it only says “error – no transport”..

          • Tom Elliott says:

            Hi Regil, yeah – the allow-access-header you added to the PHP does not work for standard $.getJSON requests through Internet Explorer. It’s a cross-domain issue and you would need to look at an XDR solution. Your easiest fix will still be to remove the ‘www’ from the $.getJSON request (as your accessing your twitter feed through non-www) so it doesn’t become a cross-domain problem.

        • Regil says:

          Hi Tom,

          It works now.. thank you.. 😀

  • Hi Tom,

    First, thanks for te excellent tutorial!

    I’m getting an alert error when I reload the page or change to another page before the tweets are loaded. I noticed that it happens with your demo too, is that ok?

    Thanks again for the great tutorial!

    • Tom Elliott says:

      Hi Hian, that’s odd and I don’t see the error on the demo. What browser are you using? If you can you send me a link I’ll take a look

      • Adrian says:

        I have the same problem. It seems to be Chrome that forces the user to press Ok on this “error-” alert. Chrome error console shows no issues. In Firefox I can see the alert error appear but only for a split second and it continues to the next page/refresh without any user interaction needed. I don’t see any error popup in IE. Maybe the same thing happens as in FF, but it’s too fast to catch. Confirmed the same thing happens on your demo page for this if you refresh before the tweets are loaded.

        The Tweets display fine, by the way. It’s just the alert issue if you leave the page before the twitterfeed.js does it’s thing I guess.

        My Chrome version is 28.0.1500.72 m

        • Tom Elliott says:

          Hi Adrian, thanks for letting me know about the issue. It seems if the page is refreshed or someone presses back or forward before the tweets load then the error is triggered. I’d comment out the alert(textStatus + ” – ” + errorThrown); line until I can figure out how to trigger it only after the PHP tweet file is loaded.

          • Adrian says:

            Thanks for the reply, Tom. I’ve added in your twitter feed caching, which is a way around the problem for now, but I’ll comment out that line too 🙂

  • Stephen says:

    Hi There,

    I seem to be able to get everything to work apart from the profile picture… not sure where I am going wrong here 🙁

    any clues?

    Thanks in advance

    Stephen

  • All sorted – being dim – the twitterfeed.js was looking for the images in ‘js’ removed this and it works 🙂

    Thanks this is v.cool 🙂

  • Eduardo says:

    Hello again. I just sent you a comment, never mind that.
    I saw one of the comments above with the same issue:
    “Hey there, it’s a cross-domain error as your trying to access the tweet file from non-www. If you change your $.getJSON request to your get tweets php …”
    Solved it!
    Thanks a lot.
    Eduardo

  • Dimitris says:

    Hello,

    First of all a lot of thanks for the very helpful guide.
    Second into my issue/question. Well i would like to ask how can i make the script to update dynamically the tweets, i mean as it was before on twitter stream api v1 when you had the stream and it was refreshing automatic and shown different tweets.
    I hope you understand what i mean.

    Thanks again and wait for answer.
    Dimitris

    • Tom Elliott says:

      Hi Dimitris, thanks for your comment – yeah, entirely possible to get the stream to refresh automatically. Take a look at the JavaScript on the twitter search post – hopefully you can get what you need from there and you’ll need use a setInterval() function as a timer to refresh.

      • Dimitris says:

        Thanks a lot for the response.
        My problem is ( i don’t know if i am doing everything wright ) that while my php page shows the proper results,all the tweets and the new, my html page does not show that,only shows some old tweets and does not refresh.
        For the js file i have done the following
        var autorefresh = true;
        var refreshinterval = 10000;
        var refreshtimer;

        and into my html i just call the two js files

        Also of course into the twitterfeed.js i call the php page.

        What the html page does not work proper ( not showing new tweets at all, only some old and does not refresh).

        Thanks.

        • Tom Elliott says:

          Hi Dimitris, can you send me a link to your HTML page that’s pulling in the tweets and I’ll try and take a look

        • Tom Elliott says:

          Hi Dimitris, thanks for the link – your HTML page is seems to show all the latest tweets as generated by the tweets PHP file – regarding the refreshing, you need to put the $.getJSON function with a new function that you can call based on the refresh interval e.g.

          refreshtimer = setInterval(gettwitterjson, refreshinterval);
          gettwitterjson();

          function gettwitterjson() {
          $.getJSON………… etc
          }

          Hope that helps,

          • Dimitris says:

            Hi,
            Really appreciate your big help, very thanks. I have tried but i can not understand what i am doing wrong.

            I send you my js file so see if is something wrong from my side.
            http://onelocal.de/twitteroauth-master_1/js/twitterfeed.js

            Thank you very much Tom, you are very helpfull.

          • Tom Elliott says:

            Hi Dimitris, I can’t see anything you’re doing wrong. The twitter feed seems to be parsing fine and it may well be refreshing but we just don’t notice it – try un-commenting the line alert(feeds); just inside the get json function which should pop up every 10 seconds?

          • Dimitris says:

            Hey Tom,

            Well i have made it up to do it but nothing happens, i suppose as i wanted to happen, the script seems to work but only refresh the page searching if new tweet exists so to display them.

            That i wanted to is to refresh and show a different tweet every time from the existing, i mean as it was before on api 1, to show one random time e.g.every 10sec,from my existing tweets.

            Is that possible?

            Thank you.

          • Tom Elliott says:

            Hi Dimitris, ah OK – I see what you want to do now – you need a random tweet to show from a the list of tweets and a new random tweet to appear every 10 seconds. It would be possible to modify the script though not straightforward… when I look at creating some animation tutorials, I’ll try and do a version that refreshes random tweets but it’s not something I’ll be able to help you with right now

  • Hi Tom,

    Thanks for the help with this, replacing my failing twitter feed has been on my agenda for a while now.
    However, I seem to be struggling with it a little.
    I have the jSON working fine it would seem but when I open my display page I can only see my profile name and screen name. The link to twitter works but no tweets are being displyed, and i get the missing image icon where my profile pic should be.
    I also get a pop up error message which just says “error – “.
    Am I missing something obvious, jquery is still a bit of a mystery to me. Should I be using an .html file rather than .php.

    link: http://www.181webdesign.com

    Thanks
    Anthony

    • Tom Elliott says:

      Hi Anthony, looks like you’ve got most of it working now and I can see the tweets fine – just the missing images for loading, twitter bird and tweet action graphics which you can grab from the post. Yes, you can use either .htm or PHP page 🙂

  • Stuart Nelson says:

    YOUR MY HERO!

    If you could do a animation tutorial that would be amazing. Like few others I’d love to display one tweet at a time and be able to rotate through my latest tweets.

  • Joost says:

    +1 for the animation tutorial!

    Really great set of tutorials so far. Thanks a bunch. Would be perfect if you could finish it with a animation tutorial.

  • Laura says:

    Hi Tom,

    The js library is conflicting with my lightbox libraries. I have updated it to version 1.9.1 and it is still conflicting. (The twitter feed won’t even work at all when I update to 1.10.) Here is what my script tags look like in the head section.

    Know of any workarounds for this?

    Thanks,

    Laura

  • Laura says:

    Never mind, I figured it out.

    I replaced all instances of “$” with “jQuery” in jquery-1.9.1.min.js and twitterfeed.js. I did not even have to use noConflict mode.

    Thanks anyway 🙂

  • dB says:

    Hello, great tutorial! Thanks for the time put into this. I have a question however; when I try to integrate it into my site template, it throws up an error dialogue box with no message. The page still loads, and so does the twitter box, but the feeds never loads. Any thoughts? Thanks in advance!

    • Tom Elliott says:

      Hi there, the most common cause of this sort of error seems to be the use of non-www vs www in your twitter feed $.getJSON path – try putting the full path and use ‘www’ in the path if your accessing the main twitter feed from www. If that doesn’t work, feel free to send me a link to your twitter feed and I’ll take a look 🙂

  • Matt says:

    Hi Tom,
    Thanks for this script, its the only twitter API1.1 plugin that I’ve managed to successfully get working. Quick rookie question, I’ve tried absolutely everything to centre the profile image above a tweet but cannot for the life of me sus out how to do it. Please please can you help? You can find the styling that I’ve managed so far at: http://www.mdwoodman.co.uk

    Thanks in adavance,
    Matt

    • Tom Elliott says:

      Hi Matt, thanks for your comment – yeah, you could try changing the .twitter-pic class from display:block to display: inline-block;

      • Matt says:

        Hi Tom,
        No luck with that, have tried every combination I can think of? Any other ideas? Because I’m only displaying one tweet I tried to put the profile pic in the header so I could centre it but this didn’t work either.
        Thanks,
        Matt

        • Tom Elliott says:

          Hi Matt, ahh – I think I also added text-align:center; to the containing class .twitter-article as well as inline-block – worked just now when I tried in in Chrome’s inspect element! 🙂

  • Matt says:

    Managed to get it working in the end, the inline-block was important but the essential style that finally solved the problem was ‘float:none !important;’ 🙂

    Thanks for all the support Tom and once again thanks for an excellent blog/tutorial!!!

  • Faruk says:

    Hi Tom, I read all your articles and created a custom twitter feed for my web site succesfully. However I have two problems.

    1. Date format is in English (e.g. 7 Jul), how can I change it to German or any other languages?

    2. I’m using my own short urls but your script gets urls as t.co.

    • Tom Elliott says:

      Hi Faruk, good questions! Not entirely straightforward but this is how I might tackle them:
      1. I’d use an array to store each month in whichever language you want in the relative time function. Instead of getting the shortdate for the month, use the month’s numerical value to get the item from the array.
      2. The t.co links are a bit more tricky. The return data from twitter has t.co links embedded as part of the main tweet ‘text’ field. You would need to detect and replace any URLs with the ‘expanded_url’ (feeds[i].retweeted_status.expanded_url) if it exists. The ‘addlink’ function might help with this.

      • Faruk says:

        Sir, I found the code below but don’t know how to adapt it to your code:

        function getDateFromString(str:String):Date
        {
        var m = {Jan:0, Feb:1, Mar:2, Apr:3, May:4, Jun:5, Jul:6, Aug:7, Sep:8, Oct:9, Nov:10, Dec:11};
        var dArr:Array = str.split(‘ ‘);
        var tArr:Array = dArr[3].split(‘:’);

        return new Date(Date.UTC(dArr[5], m[dArr[1]], dArr[2], tArr[0], tArr[1], tArr[2]));

        }

  • Mick says:

    Hi Tom I’ve read all the posts and double checked my code but cant find the same problem.

    The json outputs fine, but when I call it into the page to display it, a pop up comes up saying “error -”

    Any ideas?

  • Steve says:

    Hello,
    Thank you for this… really is what I have been looking for..
    Steve

  • Suhendra says:

    hi Tom,

    May I post this article in my website ? I would include this plugin with codeigniter.

  • Q-ro says:

    I created a way to “automatically” cache the tweets when the server/scenario wont allow you to use corn jobs or any other task automatisation tool, check it out 😀 .

    https://github.com/Q-ro/-Automatic–twitter-caching-for–cornjobless–servers

    I also made some changes to the way you laid out the HTML for the feeds inside the javascript file.
    Also added CSS enhancement as to comply with the “responsive design” trend.

    well, hope to hear form you.

  • Hi Tom, great redesign of your site in short notice. Didn’t look like this a week ago or so, right?
    I implemented your Custom Twitter Feed code. Ran okay on localhost (though not without laborious effort). When it went live, it throws the following error:

    parsererror – SyntaxError: JSON.parse: Unable to parse value: <br (on Opera)

    and

    parsererror – SyntaxError: JSON.parse: Unable to parse value: unrecognized character (on FF)

    I deleted the only [break tag] tag in the twitter-feed.js file, and there can’t be break tags in the tweets themselves. I’m fairly good with PHP so I’m sure PHP’s not to blame.

    I’d appreciate your expert recommendation or advice.

    The site is http://aadodf.org.ng/

    ***Good thing you have going on here, helping people out with these solutions.

    • I did a quick search for the word “parse” on this thread and found that someone had reported the same problem and you told him it had to do with cross-domains. I added “http://www” to the request for the get-tweets-php file and after upload and refresh, the page just pops an alert “error-“. I found this when I looked at the console as the page loaded:

      FB.getLoginStatus() called before calling FB.init().
      Security error: attempted to read protected variable
      Security error: attempted to read protected variable
      Security error: attempted to read protected variable
      Security error: attempted to read protected variable

      I also have a Facebook Social plugin box and button on the page, so…I wonder!

      Can you please help me make sense outta this? Thanks a bazillion!

    • Tom Elliott says:

      Hi Philips, thanks for your comment. Yeah my new site design went live Monday – still got a few things I want to change/add though (it’s hard to ever be totally happy with your own site!) 😉

      Anyway, your Twitter feed – you might kick yourself but your tweets php that the JS is pointing to has a PHP error. Looks like the twitter OAuth library is missing… the ‘

      • HI Tom, I was finally able to get the code to work. I posted a reply yesterday but Blimey! it didn’t appear on the thread.

        It was an issue with the call to the PHP file. I changed it from “http://” to just “//”: non-protocol specific. This usually only fails if the protocol were “file:”. The tweets now work okay. http://www.aadodf.org.ng

        I figured that good ‘ol “/” might work and tried it. It worked too. I thought it weird ‘cos that was what I had it set to INITIALLY before I began to bother you. The alert error though was different then as reported above. I might have changed some other code which I don’t remember. I simply changed it back to “//”.

        Once again, thanks a bazillion.

        • Tom Elliott says:

          Hi Philips, great stuff – glad you got your feed working. Good tip with the double backslash thing as well, I wouldn’t have thought of that! 🙂

  • Adrian says:

    Thanks for the awesome script. It’s working great bar one issue with it which I can’t figure out. I’ve used your method on two sites so far and the same issue on both:

    When I click away to another page before the previous page (more accurately the twitterfeed.js file) has fully loaded, I get an alert saying “error -” which I have to Ok before moving on. Any ideas on how to stop this alert from appearing if users click away from a page too quickly?

    • The twitter-feed.js file, though fully loaded, did not call the get-custom-tweets.php file. This caused the error.
      Try edit the call to read:

      $.getJSON(‘//[your-domain]/[path]/get-custom-tweet.php’,

      Omission of the “http:” is not a typo.
      I hope this works for you, ‘cos it worked for me.

  • Chris says:

    Thank you Tom for taking the time to write this, works like a charm, clear, concise and easy to follow. If only Twitter had someone like you writing their docs eh!

  • lydia says:

    Hi Tom!

    For some reason my previous post disappeared on your blog. I have a problem with the php file uploaded to the server. The error says: ” not found: sweets php script ” It seems get-tweets1.php is not found on the server when it is clearly there in the folder. I have double checked the path too, but couldn’t find any problems.

    Please help me

    Thank you!

    • Tom Elliott says:

      Hi Lydia, yes I’d try and get the PHP file running first and make sure you can see you’re tweets before hooking up the JS. If you’ve double checked the file path and file name, servers may still throw a 404 error if PHP isn’t setup so I’d double check the server supports PHP?

  • Tom Elliott says:

    Hi Rajit, yes looks like the Modernize WordPress theme has a widget that uses the old API and it’s no longer a simple case of changing the Twitter path/endpoint. If the theme hasn’t got an updated widget then you might need to either find a WordPress API 1.1 Twitter plugin or manually edit the themes files. You first need to get your Twitter feed authenticated (see my twitter authentication tutorial) then create a styled feed as described in this post.

  • yehudah says:

    thanks you for this great piece of code
    it has been working for me for a few days and now it has stopped

    this is the error I get

    {“errors”:[{“message”:”Timestamp out of bounds”,”code”:135}]}

    do you have any idea what this means, and how can I fix it

    thanks

  • Daniel says:

    Hello Tom, thanks for the excellent tutorial! I am new to php, javascript, and html. I’m trying to learn them by interacting with the twitter API and this tutorial is great. I have got the .php authentication working and outputting in json format as far as I can tell.

    However, when I go to run the html page with the call to the js file I just get an [object Object] pop-up window. I tried adding the $ as suggested and it didn’t do anything. Any help would be appreciated, thanks!

    I have the full www address in the getJSON line to my search_test.php file as well.

  • Pankaj says:

    Dear Sir,

    I am Looking One Twitter Widget, & Tweets Should Be Rotate
    Will You help me This Twitter Widget,

    for My Weebly Blog

    Thanks
    pankaj

  • Andy says:

    Hi Tom,

    First off, thanks for the wonderful guide and plugin. I have been able to configure the get_tweets.php fine and it is outputting json, however, for the life of me cannot get the tweets to display. I have tried every single suggestion in these comments. I am running a wordpress blog platform but this test page should not be affected by it. I previously had the cross domain error but seem to have resolved it, now it Chrome simply states “Uncaught ReferenceError: exception is not defined twitterfeed.js:115”

    This must be a generic parse error.I would very much appreciate it if you could spare the time to help me out.

    http://www.tcmzone.com/twitterjson.html

    • Tom Elliott says:

      Hi Andy, thanks for your comment. Looking at your tweets php file, there’s an additional ‘Array’ displayed right at the end. Looks like you could be echoing out both the json tweets and the $tweets array?

      • Andy says:

        Hi Tom,

        That was exactly the issue, thank you! Everything works as designed now.

        For those with the same issue as me: I simply had to remove “echo $tweets; //testing remove for production” from my get_tweets.php (part of the first step of creating a json feed.)

      • Andy says:

        Hi Tom,

        Sorry to bother you again but seems I am still having problems implementing this correctly in a wordpress environment. I am able to get everything working under a wordpress testing template: https://tcmzone.com/twitter-testing-page/

        but on the production site, the twitter-feed div in the footer is just blank. I’ve tested all the relative URLs and they seem to be correct. I’ve also removed excess JQuery snippets in my product page template without success.

        Is there something I’ve been overlooking? Thanks.

        • Tom Elliott says:

          Hi Andy, no problem – it does sound like a path issue so I would be tempted to try an absolute path first within the twitter feed js to the PHP file, making sure to use ‘www’ in the path if you access the site through ‘www’. If not, feel free to send a link

        • Andy says:

          Nevermind now, I’ve got it all working, the problem was inclusion of two jQuery libraries by accident (check this if your wordpress installation is using a plugin that inserts an additional jQuery library anywhere in your templates).

          Andy