[Plugin: Rotating Tweets widget and shortcode] Tweets are not rotating
-
Just installed Rotating Tweets; it picked up a tweet from 5 hours ago but it hasn’t rotated off that tweet. I’ve checked the setting, I’ve tweeted other things since then, but it’s still stuck. I deactivated and reactivated; I deactivated my former Twitter widget (Twitter Tools). Any other ideas?
-
Something (the template? a badly written plug-in?) is reinstalling an old version of jQuery as per:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
after the main minimised Javascript that your site is running – which includes a more recent install of jQuery (v 1.4.1 – which is also quite elderly) and the rotatingtweets Javascript – which are all currently to be found in minimised form in a single Javascript somewhere like:
<script type="text/javascript" src="https://www.multigesture.net/wp-content/w3tc/min/b6b53c03.cc0a24.js">
This has the effect of breaking all the other jQuery code on the site (including rotatingtweets)!
Unfortunately, it’s hard to identify exactly what’s happening because the excellent W3 Total Cache plug-in is minimising everything – which makes it hard to debug.
But looking at the original sleek theme, it appears to load jQuery at least twice (and not using the standard WordPress install – which in your case is v. 1.7.2!). There may be another plug-in loading it on top – but I can’t really tell.
If you can let me know which other plug-in you are using that is doing its own installation of jQuery – or let me know how your template is installing jQuery (hopefully using the
wp_enqueue_script
command) then I may be able to add a hack to rotatingtweets that solves the problem.If your template hard codes the reference to jQuery (for example in the header file) then you can try commenting it out and your site is likely to work better as a result!
To look at it another way, somewhere your site template has either something hardcoded like:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
in which case comment it out, or something like:
wp_enqueue_script('somenamethatisntjquery', get_bloginfo('template_directory') . '/library/scripts/jquery.min.js', array()); wp_enqueue_script('someothernamethatisntjquery', get_bloginfo('template_directory') . '/library/scripts/jquery.js', array());
which can both be commented out and replaced by
wp_enqueue_script('jquery');
You would also need to change any references to
somenamethatisntjquery
andsomeothernamethatisntjquery
in otherwp_enqueue_script
commands elsewhere in the template tojquery
.I think the reason that your template loads its own (old) version of jQuery may be that the javascript in
wp-content/themes/kreativethemes_sleek/library/scripts/functions.js
hasn’t been updated to reflect the change to jQuery made by WordPress. You may need either to change every reference to:$.
in the
functions.js
file to:jQuery.
to make it work.
While this approach would make your site more robust for the long term – alternatively, if you can tell me what the
someothernamethatisntjquery
names are, I can modify rotatingtweets to detect it and solve the problem without you needing to do any major work!Hi Martin,
thanks for your reply. I disabled w3 caching for now to make it easier to debug. As you noticed it is indeed using 1.3.2.
I just noticed that this is hardcoded into the sleek template when enabling the CDN option in the optimization panel.
// Choose where to load jQuery from: 1. Local 2. CDN Google if ($optimization['use_cdn'] == 'true') : echo '<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>'; else : echo '<script type="text/javascript" src="' . $template_path . '/library/scripts/jquery.min.js"></script>'; endif;
Actually even with disabling all js includes of sleek:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="https://www.multigesture.net/wp-content/themes/sleek/library/scripts/jquery.js"></script> <script type="text/javascript" src="https://www.multigesture.net/wp-content/themes/sleek/library/scripts/hoverIntent.js"></script> <script type="text/javascript" src="https://www.multigesture.net/wp-content/themes/sleek/library/scripts/superfish.js"></script> <script type="text/javascript" src="https://www.multigesture.net/wp-content/themes/sleek/library/scripts/jquery.fieldtag.min.js"></script> <script type="text/javascript" src="https://www.multigesture.net/wp-content/themes/sleek/library/scripts/functions.js"></script>
It won’t rotate for some reason.
Your page still has four separate jQuery installations! Two in the template – one standard WordPress installation (triggered by Rotating Tweets) and then another (which breaks all the preceding ones) installed by NextGen !
There are still all kinds of problem with the template, and I would suggest changing
// Choose where to load jQuery from: 1. Local 2. CDN Google if ($optimization['use_cdn'] == 'true') : echo '<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>'; else : echo '<script type="text/javascript" src="' . $template_path . '/library/scripts/jquery.min.js"></script>'; endif;
to
wp_enqueue_script('jquery');
If you want to use the Google version of jQuery, the best way is to install the Use Google Plugins plug-in in addition.
How are the other scripts added in? Do they use
wp_enqueue_script
or are they hard coded too?If they’re hard-coded, you may want to replace them with:
wp_enqueue_script('hoverintent', get_bloginfo('template_directory') . '/library/scripts/hoverIntent.js', array('jquery')); wp_enqueue_script('superfish', get_bloginfo('template_directory') . '/library/scripts/superfish.js', array('jquery')); wp_enqueue_script('fieldtag', get_bloginfo('template_directory') . '/library/scripts/jquery.fieldtag.min.js', array('jquery')); wp_enqueue_script('sleekfunctions', get_bloginfo('template_directory') . '/library/scripts/functions.js', array('jquery','superfish','fieldtag'));
It’s vital that all these lines of code come before the one that reads:
wp_head();
if they’re in the
header.php
file.This may still not solve the problem because of the way NextGen is loading the script after everything else. If you switch off NextGen, the tweets may start to rotate even now. I’m going to dig a bit further into that and find a solution that makes the plugin work alongside NextGen.
PS: I’ve just installed Rotating Tweets alongside NextGen Gallery on my test site and it seems to work OK.
Are there any other NextGen related plug-ins that you’ve installed?
I see, so I guess my site has a big jquery mess because of the way some plugins include it I suppose (and the way how Sleek has hardcoded jquery into its template). I currently have the following plugins installed (all updated to the current versions):
- Akismet
- All in One SEO Pack
- Easy JS and CSS support.
- Executable PHP widget
- Google Analytics for WordPress
- Google XML Sitemaps
- Hello Dolly
- NextGEN Gallery
- pb-embedFlash
- Rotating Tweets (Twitter widget & shortcode)
- WordPress Download Monitor
- WP-Syntax
I have disabled w3 caching for now.
Btw is the one on your demo website using a newer build, since it seems to include an avatar as well (looks great!)?
WordPress is designed to cope with lots of plug-ins, provided everyone plays fair! ??
As far as I can tell, the only two plug-ins that use jQuery are NextGen Gallery and Rotating Tweets – and they play fair with each other and try to use the standard WordPress jQuery installation!
In this case, the problem is not the plug-ins, but I think it is more likely to be the template – as outlined in my previous notes.
Spoke too soon! I’ve found the problem.
In pb-embedFlash the plug-in hardcodes in jQuery in about line 9 of
inc/req.shadowbox.php
.The simplest solution is to comment out the line that reads
$add .= '<script type="text/javascript" src="'.get_option('siteurl').'/wp-includes/js/jquery/jquery.js"></script>';
You can either remove it completely, or put
//
or#
at the beginning of the line.Martin
Ah, you’re right, seems like that plugin was messing it up! I commented out that line as you suggested (but leaving the sleek template untouched) and it finally started to scroll!
Thanks for your help Martin, I have made a small donation for your support as well.
That’s very much appreciated! Thank you. ??
Hi Martin! On my new blog (https://claimed.me) i can’t rotate my tweets… can you help me ?
thanks!
If you remove (or comment out) this line from your theme, then the plug-in should work:
<script type="text/javascript" src="https://claimed.me/wp-content/themes/min/js/jquery.js"></script>
I’m not quite sure how the theme file has put that line in. Could you let me know where you got the theme from, and I can give a more specific answer.
Martin
I’ve get min themes on themeforest (https://themeforest.net/item/min-a-minimal-wordpress-theme/57155)
i’m sorry but where a can find the line to remove ?
i ve found it! Now it’s ok, thank you Martin!
- The topic ‘[Plugin: Rotating Tweets widget and shortcode] Tweets are not rotating’ is closed to new replies.