
Many “new generation” themes, as such as P2 include a nice feature named “inline comments”: The option of having comments displayed in your index.php file. Let’s see how to do it.

Many “new generation” themes, as such as P2 include a nice feature named “inline comments”: The option of having comments displayed in your index.php file. Let’s see how to do it.
I have a hard time at first, but including inline comments on your index.php file is just really simple.
Simply paste the following code on your index.php file, where you want the comments to be displayed:
<?php
global $withcomments;
$withcomments = true;
comments_template("/inline-comments.php");
?>
What I did? That's simple: On line 2, I declare that I'll use the global variable $withcomments. I then set its value to true on line 3. Finally, I use the comments_template() function to call my comments file. The /inline-comments.php parameter tells the function to use a specific file for displaying comments, instead of the regular comments.php.
11 Responses
Hmm, i guess this would be a good tip for themes with few posts, otherwise I don’t think inline comments would be a great idea on a magazine for example
But will try this out for sure, thanks for the tip
I’ve been searching for a way to do this for a while…I can’t wait to test it out…thanks for the tip.
Very useful tip for blogs. I wil try it! Thank`s
Any ways of limiting the amount of comments shown? Like the last 3?
thanks jean. It’s a simple tricks
@Dumitru Brînzan: I agree with you, that’s bad idea on a magazine.
Excellent work !! I appreciated your work and The author of this post should be appreciated..Keep it up.
Thanks Jean.
Good work. There are some very useful WordPress tips here which I have found very useful. Thank you for sharing them with us.
Ian
Will that include the comments as lists with excerpt or something?
Im not really understanding what this code does
Trackbacks: