By ace1235 on
Is there a way to hide or remove the "Add new comment" link? I've searched around and can't seem to find a good solution for this. I've tried adding some PHP code into the template file for my theme, but that didn't work.
Is there a way to hide or remove the "Add new comment" link? I've searched around and can't seem to find a good solution for this. I've tried adding some PHP code into the template file for my theme, but that didn't work.
Comments
If you don't want people to
If you don't want people to be able to comment you can disable comments for the node type or you can set permissions so they are not allowed.
Thanks for responding. I
Thanks for responding. I don't want to disable comments. I just want to remove the link.
If you just want to
If you just want to temporarily hide the link, you can just use some basic css. Out of the top of my head, I believe the following bit should get the job done:
li.comment_add {display: none;}
Remember, this will hide it everywhere.
Shabana Navas
snavas@acromedia.com
Software Developer
Acro Media
https://www.acromedia.com
1-800-818-4564
Skype: super.shaba
Not "li" (not List-Item)
This is the HTML to be addressed using CSS;
and "li" is not accurate.
All the best; intended.
-Chris (great-grandpa.com)
___
"The number one stated objective for Drupal is improving usability." ~Dries Buytaert *
Thanks. Added the code you
Thanks. Added the code you mentioned to the style sheet but nothing happened. The theme I'm using is Bartik if it matters.
I was partially mistaken.
When the "Add new comment" link appears under a summary view of your page,
as you might see on your <front> page (Home page)
as for example when your new content
is promoted to the front page,
it is indeed a "li".
The related HTML in that case is:
Please see my other comment below that I will edit to include this case.
Give me a minute and I will try it with Bartik.
Note: I only ever have used FireBug (the awesome FireFox extension) to investigate any page's CSS.
All the best; intended.
-Chris (great-grandpa.com)
___
"The number one stated objective for Drupal is improving usability." ~Dries Buytaert *
Bad For SEO
display: noneis bad for SEO purpose. Instead i recommend Remove Links From Teaser Module for beginner.CSS solution (The theme's Cascading Style Sheets)
I am curious why you might want to do this,
yet you can achieve this using CSS.
To hide the title "Add new comment",
(h2.comments__form-title)
and the add new comment form,
(form#comment-form)
add the following code to your active theme's CSS:
All the best; intended.
-Chris (great-grandpa.com)
___
"The number one stated objective for Drupal is improving usability." ~Dries Buytaert *
Tried this but it didn't
Tried this but it didn't work. Bartik is the theme I'm using if that matters.
The reason I want to do this is because I already added a link to the comments within the content. I don't need a second link at the bottom of the page.
Alrightee then...
I think then, all you really need is what @Shabana Blackborder recommended,
except use a dash "-" instead of the underscore "_".
All the best; intended.
-Chris (great-grandpa.com)
___
"The number one stated objective for Drupal is improving usability." ~Dries Buytaert *
Still not working for me.
Still not working for me.
I am using Dupal 7.23. === I
I am using Dupal 7.23.
===
I assume the comment form is not on your page
because you have unchecked
" Show reply form on the same page as comments ";
for your 'Content type' at:
Structure >> Content types >> click 'edit' for your content type.
[d7-root]/admin/structure/types/manage/**CONTENT_TYPE**
===
Turn off "Aggregate and compress CSS files."
Configuration >> Development: Performance. ...
Heading: Bandwidth optimization
Uncheck: "Aggregate and compress CSS files."
3. Try again.
===
If that does not work,
I would be curious which CSS file you are modifying?
All the best; intended.
-Chris (great-grandpa.com)
___
"The number one stated objective for Drupal is improving usability." ~Dries Buytaert *
Note: If you are modifying Bartik
Note: If you are modifying Bartik,
it is recommended that you first create a subtheme.
See the heading "Creating a subtheme" on the page
"How to Customize Bartik" - https://drupal.org/node/1114190
All the best; intended.
-Chris (great-grandpa.com)
___
"The number one stated objective for Drupal is improving usability." ~Dries Buytaert *
I'm making my edits using a
I'm making my edits using a sub theme for Bartik. The file I'm adding the code to is "style.css" in the "css" folder. "Aggregate and uncheck css" files is unchecked. I have "Show reply form on the same page as comments" checked because I am using the Talk module to display comments + comment form on a separate tab. So, I want them to display on the same page. To test if this is why the additional css code wasn't working I went ahead and unchecked "Show reply form on the same page as comments". The additional css still didn't remove the "Add new comment" link after doing so.
I am theming the site locally if it matters.
Also, I have display suite installed. I don't know if this affects anything or not.
This is how Bartik's node.tpl
This is how Bartik's node.tpl.php solves the problem.
Replace this line (below) in the standard D7 node.tpl.php with the above, then put it in your theme's templates folder:
<?php print render($content['links']); ?>Problem solution
I had similar task on Drupal 8.3. To remove "Add new comment" & "Log in to post comments" from views of teasers but remain them in articles itself. Standard theme "Bartic".
I used module CSS Editor and fit into the theme CSS
Everithing is working.
Disabling Links field under
Disabling Links field under Manage display tab removes the Add new comment link.
"Post comments" permission required by "Authenticated" role
The "Log in or register to post comments" link only appears if the "Authenticated" role has permission
post comments; seeCommentManager::forbiddenMessage().