Unset "Add new comment" link from teasers (Drupal 7)

I have spent all of this evening failing to find an answer to what should be a simple (and widely discussed) task: namely, the removal of said link from the list of links below teasers on the Drupal 7 front page. Two or three possible solutions turned to failures. Please help me to save what is left of my grey hair.

You have two options:

  1. You can turn commenting off of the particular content type you are referring to. In D7 I believe commenting is turned off for basic page and turned on for Articles.

  2. In the editing mode on any content, you can turn off commenting under comment settings.

IF you want to maintain commenting on the content but don’t want to have commenting allowed from the homepage teasers, you can do so through CSS, jQuery (the easy way) or through theming with template.php (more difficult). Here’s a link to a theming approach to get you started in the right direction: http://drupal.stackexchange.com/questions/3270/remove-links-read-more-and-add-new-comment-on-the-home

Thanks for responding, Andrew, but you may have misunderstood me. I didn’t want to disable comments, but theme-override the links at the bottom of the teasers.

I’ve since managed to get pretty much there by unsetting all the links (losing all three) and then recreating the “read more” link. I actually needed to customise that anyway, because of an accessibility problem (i.e. avoid beginning multiple links with generic text, even if descriptive text is appended: the unique text should come first), so I got two fixes done at the same time.


function nameoftheme_preprocess_node(&$variables) {
if ($variables['is_front']) {
unset($variables['content']['links']);
}
$variables['readmore'] = t('<a class="read-more" href="!url"><span class="element-invisible">!title: </span>Continue reading</a>', array('!url' => $variables['node_url'],'!title' => $variables['title'],));
}