SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Mar 2010
    Location
    UK
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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.

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,018
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    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/ques...nt-on-the-home
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development

  3. #3
    SitePoint Addict
    Join Date
    Mar 2010
    Location
    UK
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.
    Code:
    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'],));
    }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •