StanScates/Tweet.js-Mod

Integrating with Wordpress

Catlow1989 opened this issue · 15 comments

Hi I am having issues when integrating with wordpress - if I put the twitter folder in the root directory the tweet does get pulled in and shown however this then breaks all the other JavaScript on the page (isotope), is there a known reason why this may be? Also is there anyway I can initiate the twitter.js-mod from inside the theme folder as opposed to from the root? I have tried putting the twitter folder in my theme folder but it doesnt seem to be picking up or displaying any tweets.

Any help would be appreciated - cheers!

or put more simply does the index.php wrapper conflict with other javascript classes i.e Isotope - its definately not a JavaScript clash whic is resulted in rest of page not working so it must be something to do with the index.php page - I have managed to get the feed to work from a folder in the theme.

Hi Catlow1989,

I have www.ridetheflavour.fr/twitter/ folder with index.php and /lib/ folder. Index.php is configured with Oauth credentials from twitter app.

I have

<script src="<?php echo get_bloginfo ( 'template_url' );  ?>/js/jquery.tweet.js" charset="utf-8"></script>  

in the header.php of my wordpress install.

And I have this on the first page of my website :

<script type="text/javascript">
$(document).ready(function() {
$('.tweet').tweet({
username: "ridetheflavour",
modpath: "/twitter/index.php",  
avatar_size: 32,
count: 2,
});
});
</script>
<div class="tweet query"></div>

After almost 2 hours, I can't get it working with wordpress...and it's driving me nuts !
Please, give me some advices, Thank you !

can you put an absolute url in the modpath and see if it works?

done ! here is my modpath now :
modpath: "http://www.ridetheflavour.fr/twitter/index.php",
but still no changes => http://www.ridetheflavour.fr/

in my index.php I also set absolute path to /lib/ directory.
arghhhh

please check & fix al your other errors first, it seems there are several javascript errors. (open the javascipt console in firebug or chrome)
maybe they are actually blocking execution of the tweet.js because they are stuck.

ok, I removed all the extra javascript, now remain just the minimum : http://www.ridetheflavour.fr/

It still doesn't work. I can see this error in the browser javascript console :
Uncaught TypeError: Cannot read property 'message' of null
thank you for your answers !!

I upgraded to http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js and now the error is gone. But I still can't get my tweet displaying on the website...

I spent a week on this problem after installing the new code, stuck on loading tweets.... with no javascript errors. I upgraded the hosting [to Windows 2008 Server and PHP 5.4] and without any code changes it just started working. Check your PHP version.

i have no more ideas, turn on debugging in index.php (set private $debug = true;) and look if something goes wrong.
make sure there are no typo's in the outh settings and that you filled in all 4. You could disable the caching feature..

My php version was 5.3, I set it to 5.4 => http://www.ridetheflavour.fr/twitter/phpinfo.php

no changes. I disabled the caching feature, enabled the logging, checked the Oauth credentials (all 4 are right).

Here is my jquery.tweet.js, as u can see on the second screenshot, I found another modpath ref that I replaced with absolute path as well. is it necessary ?

twit1
twit2
twit3

And here is my index.php :
twit4

Thanks a lot for your help

OKKKK it works !!!!!

I must have another problem that I solved, but in between I modified

private $lib = '/.lib/'

to

private $lib = 'http://www.ridetheflavour.fr/twitter/lib/'

in index.php and that was a big mistake (as you can see on the picture above). This path must be relative.

So now I'm not sure of what was the real initial problem, and what modification actually solved my problem (it could be javascript conflict removal, php 5.4 update, or even modpath 2nd ref in jquery.tweet.js)

Thank you guys for your help, alone I would have give up long time before. I've never been so happy when looking at a tweet on a web page...strange

@Catlow1989 if you're still struggling to get it to work there's a tutorial on Smashing Mag where they use CodeBird.

Obviously this doesn't help you with this script, but you could use it as a last resort.

@ptibbetts Cheers for the tip, it does look like a good alternative - as the site I am building has a number of JavaScript/Jquery features - including Isotope and Paralax scrolling I was resereved to start trying to figure out whether there was a script conflict once I had placed the twitter folder within the theme. My solution was in the end a simple one - I created the twitter feed at the root of my site and the simply IFramed the html feed into the section required! It may not be a perfect fix but it works which is the main thing! Thanks again for all your comments!

I am also running this plugin on a WP-based site and what did the trick for me was to put my full path in the 'modpath' parameter in my "functions.js" file

modpath: "./wp-content/themes/CUSTOMTHEMENAME/js/twitter/"

I'm trying to do this but it wont work