For example, the post date, posted by, "Add a Comment", and Taxonomy term at the bottom. These things are great for page views but unnecessary for teasers and just add clutter and make it hard to distinguish between the teasers in the list.

I've read a bunch of things about creating templates but I haven't had any luck doing it. Is there an easier way or could someone point me to a good step by step tutorial that doesn't assume I already know what I'm doing?

Thanks!

Comments

Chill35’s picture

In your theme folder, in the "template" file node.tpl.php, you can use logic with the variable $teaser, a boolean, to display what you want in the teaser view. $teaser is TRUE when the teaser has to be displayed, and FALSE when the node has to be shown in full view. You don't set that variable : you use it. And you use it for "logic".

For example :

<?php phptemplate_comment_wrapper(NULL, $node->type); ?>

<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">

<?php print $picture ?>

<?php if ($page == 0): ?>
  <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>

  <?php if ($submitted && !$teaser): ?>
    <span class="submitted"><?php print t('!date — !username', array('!username' => theme('username', $node), '!date' => format_date($node->created))); ?></span>
  <?php endif; ?>

  <div class="content">
    <?php print $content ?>
  </div>

  <div class="clear-block clear">
    <div class="meta">
    <?php if ($taxonomy && !$teaser): ?>
      <div class="terms"><?php print $terms ?></div>
    <?php endif;?>
    </div>    

  </div>

</div>

Look in the above code for the two places where I use (added) && !teaser in the if condition.

The variable $content in node.tpl.php is the entire content (body) of the node or the teaser, i.e. $node->teaser. You are left with one less thing to worry about with that variable.

Now, as far as hiding the "Add a Comment" link, you could very well hide ALL links, hence add && !teaser in your node.tpl.php file :

<?php if ($links && !$teaser): ?>
<div class="links"><?php print $links; ?></div>
<?php endif; ?>

OR, alternatively, you can use a CSS rule with a hook to that link to hide that PARTICULAR link in your theme style.css file:

.comment_add {
display:none;
}

If you want to apply all this tweeking only to nodes of a particular content type, copy and paste the content of
node.tpl.php in a new file inside the same folder with name : node-content_type_name.tpl.php
with the changes you need (and I gave you the code above, so it should be easy).

For example, if you have created a content type with name "news" then
1- create a file with name node-news.tpl.php
2- copy what's in node.tpl.php in node-news.tpl.php
3- make the changes...

You don't need to tell Drupal about the existence of a content-type-specific node template file.
It will look for one. If it does not find one, it uses node.tpl.php.

Caroline
A coder's guide to file download in Drupal
Who am I | Where are we
11 heavens

gnotorious’s picture

Thank you Caroline! I haven't had a chance to attack this yet but I think I should be able to get where I need to from this.

Chill35’s picture

It looks like a lot of code up there but it's because I copied the whole content of the node.tpl.php file. In that code, I only changed 2 lines, where I add && !$teaser. I wish I could put these "edit" in bold, so it's clearer.

Editing template files (and overriding themable functions) is easy and give us so much power over that wild beast that is Drupal.

Try it!

Caroline
A coder's guide to file download in Drupal
Who am I | Where are we
11 heavens

nipper-1’s picture

Hi,

I saw your poston drupal (http://drupal.org/node/133236) and tried to do what you said. Oddly, adding the code seems to remove nothing from the teaser view, but adds the date and comments again to the page view. Obviously I am doing something wrong, but I don't understand what. I have made a new file node-mdb_movie.tpl.php and added code below

 <div class="node<?php if ($sticky) { print " sticky"; } ?><?php if (!$status) { print " node-unpublished"; } ?>">

	<?php if ($page == 0) { ?><div class="nodeTitle<?php if (!$picture) {print ' nobreak';}?>"><a href="<?php print $node_url?>"><?php print $title?></a></div><?php }; ?>
	<div class="submitted"><?php print $submitted?></div>
  <div class="content">

  <?php if ($picture) { ?>

    <?php if ($page == 0) { print '<div class="clearpic"></div>'; } ?><?php print $picture; ?>
  <?php } ?>


<?php if ($links && !$teaser): ?>
    <span class="submitted"><?php print t('!date — !username', array('!username' => theme('username', $node), '!date' => format_date($node->created))); ?></span>
<div class="links"><?php print $links; ?></div>
<?php endif; ?>

  <?php print $content?></div>
	<div class="linkswrap">
	<?php if ($links) { ?><div class="postlinks"><?php print $links?></div><?php }; ?>
	<?php if ($terms) { ?><div class="taxonomy">Tags: <?php print $terms?></div><?php } ?>
	</div>
</div> 

It's for a movie database, and I want to show less info in the teaser view, just the name of the film and the cover image.

any thoughts?

thanks

nancydru’s picture

nipper-1’s picture

ok, installing now. thanks for the tip.

ed

edwardrapley’s picture

This one post has really expanded my understanding of how Drupal works, I'm very grateful.

Now i understand how to alter the look and feel of loads of elements which had been bothering me.

I think that the Drupal community is brilliant, whenever you have a problem there is usually a solution already posted our at least one which contributes to your own understanding and then lets you solve it yourself.

hectorplus’s picture

Well, just wanted to thank you for that bit of code && !$teaser. It was buggin me before.

Note: you may note notice the changes rite away if you are using some sort of caching mechanism, logging in may update the page.

Youfolder.com
Share what's in your folder for the Hispanic community in Canada.

yogayak’s picture

Thank you very much for the post. I was able to remove the terms from the teaser.

I now wish to remove the "send to friend" but keep the "read more". You suggest using

.comment_add {
display:none;
}

but I do not know where to insert this in the style.css as it does not mention teasers at all. Where in the style.css should I made the change.

I think the "send to friend" is called "send-link" but I am unsure. I've only found:

li class="last send"> a href="/send/send/38" class="send-link send-send send">send to friend /a>

Love and light

amedjones’s picture

hi yogayak, did you find an answer to your solution? Im on the same boat as you are. I want to remove "write comment" from the teaser section and leave "read more".

1kenthomas’s picture

I far prefer CSS methods (when viable) as they preserve the output (especially links) for SEO optimization).

Drupal tends to force you to override something (display:none to .submitted to get it off the home page) and then display where you want it (display: inline in block-views, for instance). This is a relatively painful way to get things done, especially for new Drupalers, as it can be hard to know where you want to turn something back on! and CSS is not a logical/expression language.

~kwt

4wding’s picture

I went down this path originally for tweaking the look of my teasers/body, but then realised that much of this can be done from the CCK configuration page (if you are using CCK of course)

Under the 'Display Fields' tab of your Custom type, there are a number of columns which allow you to customise the way your data will appear:

  • Label: This lets you configure the formatting of the field (Inline, Above or Hidden)
  • Teaser: This configures the presentation of the field in the Teaser only (Plain, Trimmed, Hidden)
  • Full: This configures the presentation of the field in the Body only (Plain, Trimmed, Hidden)

I found I could remove pretty much all of my custom code from the tpl.php file once I got my head around these page.

scruffd0g’s picture

Thanks for the help! I was having this problem w/ some php code I'm using in a text field showing up in the teasers, and I guess I missed the configuration options. Now everything is working great!

stormer’s picture

I added the css snippet to my style.css file but unfortunately this removes the "add comment" link globally, not just from the teaser view ie. "add comment" is no longer visible in teaser view as well as in the full node view. How can I implement it so that the link is visible in node view but not in the teaser view?

many thanks

Ole

4wding’s picture

You can try this:

.teaser comment_add {
    display:none;
}

This is setting the style only for the teaser block. Of course you need to make sure that your teaser output is actually wrapped in a teaser div, which I think it is by default.

berend31’s picture

.teaser comment_add {
    display:none;
}

That does not work. It only works when you don't add 'teaser', but that's not what we want...

Mike_Waters’s picture

div.node-teaser .comment_add
{
display: none;
}

Mojah’s picture

You may want to keep the read more link

<?php if ($links && !$teaser): ?>
<div class="links"><?php print $links; ?></div>
<?php endif; ?>

<?php if ($links && $teaser): ?>
<div class="links"><?php print l("...read more", "node/$node->nid"); ?></div>
<?php endif; ?>

Love, Live, Laugh

kyle.vh’s picture

This is a long thread. I think most people arrive here wondering how to remove 'add new comment' from the teaser. Mojah's comment, placed in your node.tpl.php file works nicely. you may have to replace your existing print $links code. Worked for me in Zen.

LGomez’s picture

Thanks Caroline for the && !$teaser tip.
This Mojah's comment also worked perfectly for me. Thankyou.

--
Gomez

TurtleX’s picture

Just what I needed. Thanks!

jorisx’s picture

this works beautiful on D6.5
thanx Mojah

Http://www.reloadmedia.com

ljet’s picture

Can you please advise me for how to remove add new comments links in drupal 4.6x.?
I cannot update it to drupal 5 or 4.7 immediately as i need to redo a lot of modification in my coding.
And I really need to remove add new comments links from the node for now.
Thank you for your understanding.

solutionsphp’s picture

Thank you, Caroline! Coming from a WordPress background, I'm more comfortable modifying the display of my sites by calling variables and using logic in templates. This seems to be done a little less in Drupal, in favor of Views, CCK and ConTemplate.

My review of David Mercer's "Drupal: Creating Blogs, Forums, Portals and Community Websites"

dbuchan’s picture

Thank you for the code !!!! BRAVO....HAIL TO THE HACK !!

visible’s picture

Brilliant, simple, works. Much appreciated.

Anonymous’s picture

Hi Caroline,
I am having trouble using the information of this page to be able to remove only one of the links in $links.
What I want is to remove the Attachment link as I am using a piece of code to display it with an icon.
Above all, the attachment link in the teaser is not a direct link, so to me it is not useful.

I didn´t manage to use the CSS turn around.

Your code show how to remove all $link and display one, but I want the oposite.
I believe the field is $attachment, but not sure.

Could you help me with that?

Michaël

eforth’s picture

I was looking for a cool way to hide the terms (taxonomy) on the Teaser. Found this topic and just did what Chill35 said and it worked like a charm =D

I added the following on my node.tpl.php inside my theme folder:

    <?php if ($taxonomy && !$teaser): ?>
      <div class="terms"><?php print $terms ?></div>
    <?php endif;?>

and it's all ok now ^^

sweethilit’s picture

&& !$teaser did the work!

nancydru’s picture

Submitted by user and date go away when you change the settings in Admin >> Themes. And I don't get the terms in teaser view with Garland.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

Chill35’s picture

And I don't get the terms in teaser view with Garland.

Garland does show terms in the teaser view. You probably modified your template so that it doesn't...?

Caroline
Who am I | Where are we
11 heavens

nancydru’s picture

I have not modified any theme code on any of my sites, other than the CSS.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

rafaeldwan’s picture

For clarity (I got confused): this option only appears in the global settings for admin>build>themes, not in specific theme's settings

-Rafael
http://mediaisland.org

mrgoltra’s picture

subscribing... newbie

faunapolis’s picture

Tried this on a new site, works, liked it.

http://www.faunapolis.org/

laryn’s picture

Need this in the near future. Thanks!

dbuchan’s picture

Yep, right..!!! user node, submit date, taxonomies, comment donot need to show in teaser but in full preview is good to show, just like http://www.usmagazine.com , right ?!
I just posted the same issue but no one couldn't give a favor they're just referring me to another link.
Finally, i'll do to work with the code that gave on this post but i'm not sure it's gonna work...I hope all friends in this issue could give me a hand while i got a problem

pbarnett’s picture

I posted the node.tpl.php code you asked for today.

Steel Rat’s picture

On a related note, I'm trying to remove the terms display altogether for nodes. I remove the obvious lines from node.tpl.php, and when logged in the terms don't appear, but they do to anonymous users, or at least one term does.

Here's my node.tpl.php:

<div class="node<?php if ($sticky) { print " sticky"; } ?><?php if (!$status) { print " node-unpublished"; } ?>">
  <?php if ($picture) {
      print $picture;
    }?>
  <?php if ($page == 0) { ?>
  <h2 class="title"><a href="<?php print $node_url?>"><?php print $title?></a></h2>
  <?php }; ?>
  <span class="submitted"><?php print $submitted?></span>
  <div class="content"><?php print $content?></div>
  <div class="clear-block clear">
    <?php if ($links): ?>
      <div class="links"><?php print $links; ?></div>
    <?php endif; ?>
  </div>
</div>

As you can see there's no "print $terms" in there at all, but it's still printing some terms for anonymous users.

I've cleared my broswer cache, tried different browsers, but the behavior is the same...

Steel Rat
My Drupal Sites:
RPGMapShare.com
Infinite Ordnance
Malvern Rouge Valley Youth Center

Chill35’s picture

for anonymous users... I've cleared my browser cache, tried different browsers, but the behavior is the same...

Drupal has its own caching for anonymous users.

How to clear Drupal's cache : http://drupal.org/node/42055

Caroline
A coder's guide to file download in Drupal
Who am I | Where are we
11 heavens

Steel Rat’s picture

Thanks Caroline. The terms eventually went away.

Steel Rat
My Drupal Sites:
RPGMapShare.com
Infinite Ordnance
Malvern Rouge Valley Youth Center

Steel Rat’s picture

Oops, got duplicated...

yngens’s picture

subscribe

pbarnett’s picture

Garland node.tpl.php modified for minimal teaser

<?php phptemplate_comment_wrapper(NULL, $node->type); ?>

<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">

<?php print $picture ?>

<?php if ($page == 0): ?> // full node in a page view
  <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>

<?php if(!$teaser) { // only show author and submission date in full node view ?>
  <?php if ($submitted): ?>
    <span class="submitted"><?php print t('!date — !username', array('!username' => theme('username', $node), '!date' => format_date($node->created))); ?></span>
  <?php endif; ?>
<?php } ?>

  <div class="content">
    <?php print $content ?>
  </div>
<?php if(!$teaser) { // only show terms and links in full node view ?>
  <div class="clear-block clear">
    <div class="meta">
    <?php if ($taxonomy): ?>
      <div class="terms"><?php print $terms ?></div>
    <?php endif;?>
    </div>

    <?php if ($links): ?>
      <div class="links"><?php print $links; ?></div>
    <?php endif; ?>
  </div>
<?php } ?>
</div>
jiangxijay’s picture

I think the // full node in a page view has to move inside the prior if statement.

The following works perfectly for me. Thank you!

<?php phptemplate_comment_wrapper(NULL, $node->type); ?>

<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">

<?php print $picture ?>

<?php if ($page == 0): // full node in a page view ?> 
  <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>

<?php if(!$teaser) { // only show author and submission date in full node view ?>
  <?php if ($submitted): ?>
    <span class="submitted"><?php print t('!date — !username', array('!username' => theme('username', $node), '!date' => format_date($node->created))); ?></span>
  <?php endif; ?>
<?php } ?>

  <div class="content">
    <?php print $content ?>
  </div>
<?php if(!$teaser) { // only show terms and links in full node view ?>
  <div class="clear-block clear">
    <div class="meta">
    <?php if ($taxonomy): ?>
      <div class="terms"><?php print $terms ?></div>
    <?php endif;?>
    </div>

    <?php if ($links): ?>
      <div class="links"><?php print $links; ?></div>
    <?php endif; ?>
  </div>
<?php } ?>
</div>
pbarnett’s picture

Added the comment whilst posting the code; never a good idea :-)

Happy that it worked for you after you fixed my foolish error!

Pete.

lias’s picture

was looking for this and works.

For sky theme:

<div id="node-<?php print $node->nid; ?>" class="node<?php print " node-" . $node->type; ?><?php print ($sticky) ? " node-sticky" : ""; ?>">
  <?php if (!$page && $title): ?>
  <h2 class="title"><a href="<?php print $node_url; ?>" title="<?php print $title; ?>"><?php print $title; ?></a></h2>
  <?php endif; ?>
  <?php if ($submitted && !$teaser): ?>
   <div class="info"><?php print $picture; ?>
   <?php if (theme('username', $node)): ?>
    <?php print t('Posted by') . ' ' . theme('username', $node); ?><?php print ($terms) ? ' in ' . $terms : ''; ?><br>
	<?php endif; ?>
	</div>
  <?php endif; ?>
  <?php if ($submitted): ?>
  <div class="info">
  <?php print $date; ?>
  </div>
  <?php endif; ?> 
  <div class="content"><?php print $content; ?></div>
  <?php if ($links && !$teaser): ?>
  <div class="links"><?php print $links; ?></div>
  <?php endif; ?>
</div>
yngens’s picture

I have little different problem. I would like to display node teasers with only titles and texts in right or left blocks. Can't figure out how to get rid of the links in "submitted" class (post date, posted by, etc), but only for the teaser displayed in blocks.

totalsense’s picture

subscribe

xjs’s picture

you can also create node specific template if you only want to change the look for particular nodes. For example, you can create a file called "node-yournodetype.tpl.php" as I described here for customizing the look of taxonomy terms.

mot1f’s picture

does anyone know if this works for teasers in views? There's all this added stuff I need to remove.

Farreres’s picture

One question. I want that comments show authors name, but that this is not shown as a link. Just the name without link. How can this be done? I suppose it has to do with playing with $links but I don't want to suppress the authors name, only disable it as a link. Any hint?

ench0’s picture

Alternatively, to hide the terms you could use the term_display module.

The good thing about this solutions is - you don't need to do any coding or template/CSS modifications.

The bad - this module will just plain always hide the specified terms/vocabularies, i.e. you won't have control over whether you want to show them in page view and hide them in teasers. Works quite well for some vocabularies, though.

www.fxsoftwaresolutions.com

krisk’s picture

I would like to remove the submitted by and terms fields from the teaser but when I add the code from this post to the teaser file, it removes the submitted by from both the teaser and the full post and does nothing with the terms in either.

The code for the node file in this theme looks significantly different than shown in this post. Here it is:

<?php if ($type!='storymin'): ?>
  <?php if ($submitted): ?>
    <span class="submitted"><?php print format_date($node->created, 'custom', "F jS, Y") . theme('username', $node); ?></span>
  <?php endif; ?>

  <?php if (count($taxonomy)): ?>
    <div class="taxonomy"><?php print t(' in ') . $terms ?></div>
  <?php endif; ?>
  <?php endif; ?>

  <div class="content">
    <?php print $content; ?>
  </div>

<?php if ($type!='storymin'): ?>
  <?php if ($links): ?>
    <div class="links">
      <?php print $links; ?>
    </div>
  <?php endif; ?>
  <?php endif; ?>

There doesn't appear to be any reference to the teaser in the CSS so I don't know that I can do anything with that.

pbarnett’s picture

<?php if ($type!='storymin'): ?>
  <?php if (!$teaser && $submitted): ?>
    <span class="submitted"><?php print format_date($node->created, 'custom', "F jS, Y") . theme('username', $node); ?></span>
  <?php endif; ?>

  <?php if (!$teaser && count($taxonomy)): ?>
    <div class="taxonomy"><?php print t(' in ') . $terms ?></div>
  <?php endif; ?>
  <?php endif; ?>

  <div class="content">
    <?php print $content; ?>
  </div>

<?php if ($type!='storymin'): ?>
  <?php if ($links): ?>
    <div class="links">
      <?php print $links; ?>
    </div>
  <?php endif; ?>
<?php endif; ?>

Pete.

krisk’s picture

Yes, that does actually work. I found too that if I just copied the whole code rather than trying to insert the teaser stuff that that worked as well and actually handled the taxonomy terms on the full view in a nicer fashion so I just kept that.

Thanks for your help. I'm teaching myself this as I go.

lias’s picture

This code worked well to hide my taxonomy on specific node types - in drupal 6!

saltcod’s picture

thanks!

mukund_nadkarni’s picture

Is it possible to control the display of different node types with multiple CSS files, each for a specific node?!!

david.sarnowski’s picture

I am trying to get the "add comment" and taxonomy terms to hide from my teaster view. I want to keep the "...read more" link on the teaser view.

I have tried the following and it leaves the "...read more" link in the teaser, but it also appears on the node view now. Also, the "add comment" link is gone from the teaser (which is good) but gone from the full node as well. Can anyone help me out? I am absolute php novice.

Thanks,

Dave

<div class="node<?php if ($sticky) { print " sticky"; } ?><?php if (!$status) { print " node-unpublished"; } ?>">
  <?php if ($picture) { print $picture; }?>

  <?php if ($page == 0) { ?>
    <?php if ($title) { ?>
      <h2 class="title"><a href="<?php print $node_url?>"><?php print $title?></a></h2>
    <?php }; ?>
  <?php }; ?>

  <div class="content"><?php print $content?></div>
  <div class="clear-block clear"></div>

  <div class="clr"></div>

  <?php if ($links && !$teaser): ?>
    <div class="links"><?php print l("...read more", "node/$node->nid"); ?></div>
  <?php endif; ?>

  <?php if ($terms && $teaser) { ?>
    <div class="tagindent"><span class="submitted"><?php print $submitted?></span><br />Tags:<span class="taxonomy"><?php print $terms?></span></div>
  <?php }; ?>

</div>
pbarnett’s picture

Looking at the code, there are two conditional statements -
<?php if ($links && !$teaser): ?>
which means 'Do this if $links is true and $teaser is false, and
<?php if ($terms && $teaser) { ?>
which means 'Do this if $terms is true and $teaser is also true.

We're not here to provide a PHP 101, but does this help?

Pete.

david.sarnowski’s picture

Pete, thanks for the help. That got me sorted with my language. One final question. I have read some php tutorials at w3schools about "if else" and organisation here looks different. Where could I put the "else" html that I want to show if the conditions I set are false?

I realise these are simple questions, but I do not know where else to look for basic php help in Drupal. If you know of another resource, please let me know.

Dave

pbarnett’s picture

Hi Dave.

You could do something like this :-

<?php if ($condition) : ?>
  // executed if $condition is true
  // executed if $condition is true
<?php else: ?>
  // executed if $condition is false
  // executed if $condition is false
<?php endif ?>

Taken from my copy of O'Reilly's 'Programming PHP'; £8.00 from EBay :-)

Pete.

kaido.toomingas’s picture

Thanks..

mlbinseattle’s picture

To mojah and Caroline: Thanks for the examples. Caroline, your logic worked beautifully. I didn't realize it was so easy, and I'm no php expert by any means. It became apparent real quick that the "!" was used as a "not" function with the boolean logic...I had seen this used with conditional statements for IE. It was then that I had the "lightbulb" moment.

I actually learned something about php, today. :)

Michael

balik kampung’s picture

Without much sweating i have used Mojah's code and it worked great on my drupal 6x site.
But this issue do not happen for all themes. some themes are doing this (removing/disabling) add comments link from the teasers automatically. However few themes are not.

I would rather expect Drupal to provide this option as core feature some where in post settings in administration and that would help every one.

you can look at it at http://www.balikampung.com/articles

thanks again

nancydru’s picture

pyxio’s picture

Greetings,

There lots of good advice here about how to hide default variables, but how do we go about hiding a div layer from a teaser?

Thanks
Kevin

nancydru’s picture

You should look at a CSS tutorial for hidden divs.

pyxio’s picture

Hi Nancy,

I thought of that, but if I hide a DIV in css than it will be hidden in both the teaser AND the full node view, wouldn't it?

nancydru’s picture

Teasers have a class of node-teaser added to them.

pyxio’s picture

I tried this:

div class="addtoany"

In CSS:

.addtoany .node-teaser {
display:none;
}

That does not work. Can you see what I'm doing wrong? Many thanks for your help.

nancydru’s picture

The classes need to be in the order they are encountered in the HTML. In this case ".node-teaser" comes first.

.node-teaser .addtoany {
  display: none;
}
pyxio’s picture

Perfect! Thanks!

jaap76’s picture

How to remove the login/ register message from the comment module?

Edit: http://drupal.org/node/232310#comment-5003814

nancydru’s picture

The easiest way is to allow anonymous commenting, but you will start getting lots of spam.

Use Firebug to see if it has a special class (I think it does) and add CSS to not display it.

jarednielsen’s picture

This is totally ridiculous that the easiest way to remove the "Add comment" is through the theme. Why is there not an option within Drupal core?

nancydru’s picture

If you don't want comments at all, then just disable them in the node or the content type.

John Ching’s picture

In Drupal 7, the codes in node.tpl.php of themes\templates are different from those showed in earlier comments. I had to do it different but I used Caroline's instructions to arrive at the solution. Open file sites\all\theme\yourtheme\templates\node.tpl.php

Look at around line 38 to line 43. Look for:

  <?php if ($display_submitted): ?>
    <footer class="submitted<?php $user_picture ? print ' with-user-picture' : ''; ?>">
      <?php print $user_picture; ?>
      <p class="author-datetime"><?php print $submitted; ?></p>
    </footer>
  <?php endif; ?>

add && !$teaser after $display_submitted

It should then be like this:

  <?php if ($display_submitted && !$teaser): ?>
    <footer class="submitted<?php $user_picture ? print ' with-user-picture' : ''; ?>">
      <?php print $user_picture; ?>
      <p class="author-datetime"><?php print $submitted; ?></p>
    </footer>
  <?php endif; ?>

Save your file and go have a look.

nancydru’s picture

Most things can be hidden in the "Manage display" page for the Teaser display.