W3 Total Cache Rotating Tweets = Not updating tweets?
-
First of all – great plugin! Thank you very much for it.
Now the problem – tweets are not updating but as admin while loading a non-cached version of the site – it works fine. I suppose it’s Total Cache.
So the stupid question is – how do I make it work? =)
-
Well Martin, as I said – this is a bit too complicated for me. The W3TC settings I use are from some guide for “best settings”. I’m glad you have the plugin working on your setup. Now I have to fix mine because for some reason it does not update at all now…
The Rotating Tweet plug-in should now work on all sites using W3 Total Cache sites that are set up for Fragment Caching.
The recommended settings you are using mean that the fragment caching service cannot work – on Rotating Tweets or any other plug-in or template that uses the W3TC fragment caching service.
This is because of the way that W3TC is written – and is not fixable via the Rotating Tweets plug-in. It would require a major rewrite of the W3TC code.
To make the fragment caching work, all you need to do is switch off HTML (GZIP) compression. That’s it. Nothing more, nothing less.
To make the page update when you reload the page, you will need to switch off browser caching of HTML.
These are two tiny changes which will make almost no noticeable to how quickly your site downloads and how much load is put on the server. The file we are talking about not caching or compressing is 5KB. It makes an irrelevant difference to how quickly your site loads.
There is no other way to fix it. But these changes will fix it.
Now I get this instead of RT:
<!-- mfunc secretstering $rt=get_transient("rt-mf-f48bb99f57e425972374bac7bcae7f87");if(!empty($rt)){echo $rt;}else{$args=get_transient("rt_w3tc_secretstering");rotatingtweets_display($args);}; --><!-- /mfunc secretstering -->
Hmmm. Obviously got a bit overconfident there. Looks like W3TC is not spotting the code and replacing it.
If you’re using a shortcode in a post or a widget, then I’m baffled – since these are working for me and should work according to W3TC. Perhaps your secret code is too complicated (although this seems unlikely)?
Alternatively, try switching everything off in W3TC except for basic page-caching and seeing if that works – and then gradually switch everything back on again until it breaks.
If you are displaying rotating tweets by using something like:
do_shortcode('[rotatingtweets .... ]');
then the only answer I can think of is to change it from a function into a widget (which is probably a good idea anyway), by putting something like:
dynamic_sidebar('topwidget');
in the template instead of the shortcode – and something like:
$args = array( 'name' => 'Top Widget', 'id' => "topwidget", 'description' => '', 'class' => '', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => "</div>\n", 'before_title' => '<h2 class="widgettitle">', 'after_title' => "</h2>\n", ); register_sidebar( $args );
in your
functions.php
file.As far as I know I can not to use it as a widget if I want to keep RT rotating where it is now – in the header.
Anyway – this has proven to be harder than I expected and I’m having difficulties keeping track and finding time to do all the changes.
I’m sorry Martin – I won’t be able to go on with it. Thank you very much for the support. I hope someone else who is more experienced with this than me would come up and continue with the testing.
You can – by putting your own widget area in the header (which is what the code I outlined should do).
But I realise this is getting pretty seriously technical now!
No worries if you don’t want to go any further though. You’ve helped get a useful new piece of functionality added to the plug-in – and made me improve how it caches itself as well.
In practice – unless you have a fairly high traffic site – your best option might be to switch off W3TC altogether! If that isn’t appropriate, putting it on a fairly short caching period should also help.
My problem is not with the traffic – the hosting plan is the cheapest and unreliable – that’s why all the aggressive caching. Or am I on the wrong path again…
I’m glad I could help!
I’d be tempted to move to a better host… it’s surprisingly easy to do! ??
After some playing around I found that if Minify is enabled, if there is a new tweet and the browser is not logged on WP, RT shows as empty space.
Martin – I see you have labeled the issue as resolved – could you make a guide on how to use RT with W3TC?
PS
W3TC use is tricky because in order for it to function as set a few .htaccess files have to be edited – which ones have you edited and what did you put in?I suspect that’s because you still have
W3TC_DYNAMIC_SECURITY
defined or are usingw3tc_render_to
in your short-code.RT is rendering the
mfunc
comment, but because W3TC appears to only convertsmfunc
in posts or widgets, minify just removes it (as it does all comments).Quickest solution is to remove
w3tc_render_to
from the shortcode.Since you said I have to use W3TC_DYNAMIC_SECURITY and w3tc_render_to you never said I have to remove them. We do need a guide on how to make RT and W3TC work together.
To make the two work together, you will almost certainly need to implement the widget area as explained here.
This is about removing settings that you no longer need.
Martin, I’m not sure how to say this once again but could you explain step by step how to make RT work while W3TC is active? What settings should be on and what off and what exactly did you do to make both work at the same time?
The way I made fragment caching work was:
- Used the latest development version of the plug-in
- Added
define('W3TC_DYNAMIC_SECURITY','my_own_secret_code');
to
wp-config.php
- Changed the settings of W3 Total Cache to
- enable ‘Disk: Basic’ caching on the General Settings page
- enable ‘Late Initialisation’ on the Page Cache Settings page
- disable HTML compression by unchecking ‘Enable HTML (gzip) compression’ on the Browser Cache page
- during the development stage of this process, disabled Minify HTML in the Minify settings page.
- Either
- Included
w3tc_render_to='another_secret_code'
in a regular Rotating Tweets shortcode used in a page or a post – or - used a widget normally without any extra special settings.
At this stage, I haven’t personally testing making Rotating Tweets work by hardcoding Rotating Tweets into a template – for example via code like
<?php echo do_shortcode( "[rotatingtweets screen_name='your_twitter'] w3tc_render_to='secret_mystery_name'" ); ?>
although this may be possible.
In the event that hardcoding into the template doesn’t work, I would experiment with using a regular widget or a regular shortcode in a post or a page and see if either of these approaches work when the
echo do_shortcode()
approach doesn’t.In the event that the
echo do_shortcode()
approach doesn’t work but a test widget does, I would suggest replacing this code with something like:<?php dynamic_sidebar('extrawidgetarea');?>
and adding code to your template’s
functions.php
file such as:$args = array( 'name' => 'Extra Widget Area', 'id' => "extrawidgetarea", 'description' => '', 'class' => '', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => "</div>\n", 'before_title' => '<h2 class="widgettitle">', 'after_title' => "</h2>\n", ); register_sidebar( $args );
and seeing if a Rotating Tweets widget in the new ‘Extra Widget Area’ works as well.
In the event that a test widget or shortcode also doesn’t work, I would experiment with switching off everything in W3TC except Page Caching and Late Initialisation and seeing if it is possible to identify a further W3TC setting that may be breaking the code.
Hope this helps!
Thank you.
What is this “another secret code”? Shouldn;t it be the same as the one in wp-config?
Now I get this error:
Fatal error: Can't use function return value in write context in /home/.../wp-config.php on line 104
- The topic ‘W3 Total Cache Rotating Tweets = Not updating tweets?’ is closed to new replies.