I posted on the issues forum for Wordpress and didn't meet with much success. You can see the one response I got here.
The AJAX calls are actually generated by javascript from the file ./wp-content/plugins/jetpack/modules/carousel/jetpack-carousel.js. The easiest way to disable comments from causing server load is to edit the file by finding the lines:
getComments: function( args ) { if ( 'object' != typeof args )and change them to
getComments: function( args ) { return; if ( 'object' != typeof args )which effectively disables the getComments function.
Hi William, You are Top Man :) just wanted say thank you. Code works perfectly.
ReplyDeleteThe big downside is that you have to re-do this after every jetpack update. But the load from those ajax calls just killed my site.
DeleteThanks!
ReplyDeleteNice work, thanks
ReplyDeleteHi, tried that and it turned off the comments link but the comments box was still there
ReplyDeleteFixed it by taking out the form section section at line 102 but this is not a very elegant solution.
ReplyDeleteI think you'll like my solution. Give it a shot when you get time: http://aahank.com/2013/disable-comments-jetpack-carousel/
ReplyDeleteOf course, it wouldn't be possible without the help of your solution. So, thank you for that. :)
Aahan, very nice. Both more thoroughly written and a more elegant solution. My concern was breaking carousel completely when another one of the WP Admins for my site updated jetpack. This way, worse case is that the update happens, we post a popular carousel, and the site slows to a crawl.
ReplyDeleteIn conjunction with this, I also wrote a short bash script that checks to make sure some of the edits I have put in place within Wordpress are still there and emails me daily if they are not.
May I please ask the opposite question? On some pages comments do not display - no text entry box - but I want them on all carousel pages. What is the difference that I can iron out? I see no obvious visual item in the dashboard.
ReplyDeleteThanks for allowing the question.
past this code in any loaded css file on your affected site:
ReplyDelete.jp-carousel-info {
display: none;
}
evidence is on www.evopics.de
I had not used that particular bit before, but as I suspected it does not actually disable the ajax calls, it just disables the display of the data retrieved from the ajax call. I want to disable asking the server for comments, because these ajax calls are dynamic requests that require PHP and Database interaction causing load. We have had pages using Carousel which get a substantial number of requests for a relatively short period of times and these Ajax calls are sufficient to crush the server which performs handily after the above "return;" is added.
ReplyDeleteHi William, for some reason my comments are still showing up. Have there been any changes to the code?
ReplyDeleteThank you : )
We are continuing to use the same solution, re-implementing it each time after we update the jetpack plugin. We have the style bits in our themes style.css, and then the return mentioned above.
DeleteAre you using this in your css?
ReplyDelete.jp-carousel-info {
display: none;
}
I have the following entries, not sure any of them do anything in our scenario:
Delete.jp-carousel-image-meta {
display: none;
}
.jp-carousel-info {
display: none;
}
#jp-carousel-comment-form {
display:none;
}
Great, thank you William!
ReplyDeleteI simply want to tell you that I am new to weblog and definitely liked this blog site. Very likely I’m going to bookmark your blog . You absolutely have wonderful stories. Cheers for sharing with us your blog. John
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThank you! And this perhaps?
ReplyDelete...plugins/jetpack/modules/carousel/jetpack-carousel.php
Line 243 (or so) :
$attr['data-comments-opened'] = $comments_opened; Change it to "closed"
$attr['data-comments-opened'] = $comments_closed;
Barbaric, but works... after closing ajax of course.
Thank you!
When the enemy is tearing down the walls, I have no issue resorting to barbary ;)
Delete