[bottom]

Tuesday, September 27, 2005

Blogger Hack

Tired of "0 Comment(s)" ?

When you have no comments made to your post and you'd rather not display the totally pointless and lame remark "0 Comment(s)"
(it's like "Not your birthday today..." and "1 Comment(s)" just looks dumb). Here is how I got rid of it.

1. Place this JavaScript function in the <head> section of your template

<script type="text/javascript">
<!--
function wcomment(num, nothin){
if (num == 0){
if (nothin) {
document.write('');
}
else
{document.write('Add Comment');}
}
else if (num == 1)
{document.write('1 Comment');}
else if (num > 1)
{document.write(num+' Comments');}
else
{document.write('Add Comment');}
}
// -->
</script>

2. Replace this tag: <$BlogItemCommentCount$> :

* If zero comments and you you want to display NOTHING:
replace every single <$BlogItemCommentCount$> with this code:
<script type="text/javascript">
<!--
wcomment(<$BlogItemCommentCount$>);
// -->
</script>


* If zero comments and you you want to display "Add Comment":
Replace every single <$BlogItemCommentCount$> with this code:
<script type="text/javascript">
<!--
wcomment(<$BlogItemCommentCount$>,'y');
// -->
</script>

  • Blogger Smokin' Mama  |  9/28/2005    

    I'm so glad to have discovered you Robert. You are so helpful. I'm actually going to attempt this 0 comments alternative. We'll see how it goes..... I totally agree with your Myspace observation. It's as if it were managed by Real World alumni no?

    Maggie~

  • Blogger Robert  |  9/29/2005    

    Maggie, thanks for the kind words. I am glad you find this hack useful as well.
    Do't hesitate to drop a note if you have a question.

Post a Comment

<< Home


Recent posts


[top]