Several people have posed questions about how to disable comments from Jetpack Carousel module in WordPress. There is a method that has already been discovered, but it requires a change to a plugin file. I’ll briefly mention those, but since I’m very much against changing any core or plugin files directly, I’ll show you another way to disable comments using CSS.
If AJAX calls are causing issues with your site, the pure CSS method won’t help. But if all you want to do is hide the ability to comment, read on.
Aahan Krish showed us how to disable comments using PHP code, in conjunction with a change to the jetpack-carousel.js
file included with the plugin. Aahan piggy-backed off of work by William Thomas on disabling the AJAX calls to getComments
for each image in the carousel (be sure to read through the comment thread).
If the load on your site from the AJAX calls to getComments
is not an issue, and you’d just like to hide the comment form…
How to Disable Comments on Jetpack Carousel with CSS
You can place this code in several different places. It’s up to you where you put it. And depending on where you add it, you might not need the !important
declarations. I’ve chosen to add this to the “Custom CSS” Jetpack module (ironic?), which loads before the “Carousel” CSS, thus why I am using !important
.
The first declaration hides the Jetpack comment form container, the “Comment” link located to the right, directly above the “View Full Size” image link, and the “Loading Comments…” text.
You are left with a small gray area where the “Comment” link used to be. This is due to some padding & a background color. Remove the padding & the space is gone.
/* Jetpack: Carousel ****************************************** / /* Hide Comment Form & Link */ #jp-carousel-comment-form-container, /* Form */ div.jp-carousel-buttons a.jp-carousel-commentlink, /* Link */ #jp-carousel-comments-loading /* Loading Comments text */ { display: none !important; } /* Remove Padding from Link Area */ .jp-carousel-buttons { padding: 0 !important; }
“Loading Comments…” Text
Unfortunately, you will still (albeit, very briefly) see the “Loading Comments…” message appear while each new image is loading. This is added via javascript, and even the plugin author says it cannot be removed.
@Sebas helped us out with a way to disable the “Loading Comments…” text. I’ve updated the CSS code above to include a line for #jp-carousel-comments-loading { display: none; }
.
We Recommend
https://kinsta.com › wordpress-hosting
Fast and secure infrastructure, worldwide CDN, edge caching, 35 data centers, and enterprise-level features included in all plans. Free site migrations.
https://gravityforms.com › features
Create custom web forms to capture leads, collect payments, automate your workflows, and build your business online. All without ever leaving WordPress.
Leave a Comment