Posted by KaiseRCrazY on 11th October 2009

How to include comments in posts lists?

You can show comments on index.php. Some new themes support this. Also you can add this option to your themes.

Here is the code;

First one you download your theme’s index.php. After that open the file with your favourite text editor and paste this code wher you want to show your comments.

<?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.

That’s All. Have a nice day!

The Original Post!

  • del.icio.us
  • Digg
  • Facebook
  • FriendFeed
  • Reddit
  • StumbleUpon
  • Technorati
  • PDF
  • Print

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

No comments yet!

Post your comments