Page 1 of 1

Hiding Empty Trackbacks and Comments

Posted: Sat Apr 28, 2007 4:07 pm
by steven
Is there a plugin or other way to hide the comments and trackback sections if they are empty?

I do not want to eliminate those items. Many of my posts are announcements. My readers are not big commentors and the blog looks a bit deserted with the comment area present but blank.

Thanks

Re: Hiding Empty Trackbacks and Comments

Posted: Sun Apr 29, 2007 1:31 pm
by garvinhicking
Hi!

No plugins for that, you must edit the entries.tpl file and add smarty checks:

Code: Select all

{if $entry.comments > 0}
...
{/if}
Quite easy. :)

(However: How do you add comments on entries without comments when you don't see the comment section? ;-) )

Best regards,
Garvin

Posted: Sun Apr 29, 2007 6:45 pm
by steven
If the comment count and the comment form are all part of the same section, I guess I can't. I was just trying to eliminate the headers and count part but leave the comment form for those that want to use it.

Thanks for the code.

Posted: Sun Apr 29, 2007 7:30 pm
by garvinhicking
Hi!

Hm, I believe you can put the comment form seperately. I believe in the entries.tpl file there's a {serendipity_showCommentform} or sth. like that function call?

HTH,
Garvin