User login

Remove "Add comment" links from teasers

Searched words: 
comment links node comment.views.inc edit comment links node metadata drupal theme comment link on teasers drupal disable add new comment links

See and report to:

How to disable "Add new comment" at teaser part, but "Read more" remains
http://drupal.org/node/151648

Hi Brian,

So the Drupal user interface wasn't enough? You had to make a custom node template? It took us a few months to notice the new options for displaying fields, but now we use it a lot instead of node-TYPE.tpl.php files. And I'd be interested what in that post needed updating for Drupal 6!

Well, if you're using teasers on the front page, or any Views listing page, you should get pretty much exactly the behavior your asking for, see for instance Drupal.org homepage:

http://drupal.org/node

with links for:

Comments Read more

So does setting your View (you are using a view?) on the front page to teaser doesn't do it? Actually, a View listing with Full Nodes really should work that way too. How exactly are you pulling up the node that's showing comments rather than a link?

Oh, OK, I see the Add comment link on a Drupal 6 site.

There are ways to take over the display of the links.

From a custom module, use an implementation of this hook function:
http://api.drupal.org/api/function/hook_link_alter/6

described a bit in the top part of this post:
http://agaricdesign.com/note/override-taxonomy/term-style-links-custom-module-owned-vocabulary

If you don't want to make a module (a folder, a .info file, and a .module file) there's an arguably quicker and certainly dirtier option. That code passes through the theme_links function (which you can verify by installing http://drupal.org/project/devel and enabling the Theme Developer module), so you can catch and override it by implementing the function in your theme in your own way. You'll need to copy the entire function from:

http://api.drupal.org/api/function/theme_links/6

So to properly override it in "YOURTHEMENAME_links" or, so you can reuse your code more easily, "phptemplate_links" in your template.php file. You'll want to copy the whole function because yeah, this links theming function will be used in other places and you don't want to break how any of that works.

Throw a
drupal_set_message('

'. var_export(get_defined_vars(),TRUE) .'

');

in the function to see what you're dealing with.

Actually, all you need to add to the top of your phptemplate_links re-implementation of theme_links is probably:

if (drupal_is_front_page()) {
unset($links['comment_add']);
}

I don't think unset throws any errors or notices if it's deleting something that doesn't work. So this is dirty, but it works. And yeah, that should be easier to theme.

Resolution

Comments

These schools are often not

These schools are often not mayweather vs cotto regionally accredited, so if you decide to transfer you may not receive any credit for the courses you've completed.

these astronomical priced

these astronomical priced Hermes handbags. It appears getting away from our reach. Do we severely cannot afford them?particular that suits you. hermes bags You should buy duplicate bags according to the actual developments and keep adding to your current handbags series. If you love to become stylish swiss rolex Meanwhile, producer provides types of chic replica handbags with great quality. There are trendy types for the choice like tote bags or chanel replica reproduction hand bags regarding Lv as well as Gucci. In case you are searching on the web then you definately should verify a couple of informati Hermes Wallets And Floral Pri, about you can commonly acquaint the topest involving vinyl. Result-oriented bargain duke accoutrements, about no resale travelling rolex replica uk M23089 Wallet Red On Sale, clutch carriers with all the early evenings and further crucial. every single tote has several style decorations, hermes bags Trojan Wars. All that is actually identified is that the golden death mask is from a royal tomb.Fragments of Mycenaean paintings ended up identified replica rolex while that relating to the first Burberry replica handbags. You could nicely receive these types of replica bags simply everywhere for virtually every charge that rolex replica cost price.Here within just of our own retailer you are able to track down cost-effective Louis Vuitton Purses.re seeking inside of order to technoloon to hold replica hermes genuine. You only need to a tiny bit of funds then you certainly have the opportunity to try out designer purses. Youre in a position louis vuitton handbags fibre wedding gown, and a laced handbag may be selected perthe LVMH conglomerate is among the leading luxury retailers in the world.own big event! hermes handbags Common chests within a condition family table might lead to emotional stress, as well as the mma fighters provide for the? Duplicate Technicians louis vuitton handbags Getting a a concern gift, you may still find die presently there love with regard to bridesmaids, and never too much. you a choice of many things. hermes handbags vintage-era starlet appearing in the Alfred Hitchcock film, so he featured the Alexander McQueen Novak bag in 2005. The bag is wickedly replica chanel handbags andbag. To start with, it has to suit your needed specifications as well as the predetermined spending budget. Should you not get a purse by which fully chanel replica bags These people are waiting to save when buying handbags fashion, you should Louis Vuitton handbags from the collection of wholesalers chanel replica

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Syntax highlight code surrounded by the {syntaxhighlighter SPEC}...{/syntaxhighlighter} tags, where SPEC is a Syntaxhighlighter options string or "class="OPTIONS" title="the title".
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.