WordPress.org

Ready to get started?Download WordPress

Forums

How to display user comments on home page? (3 posts)

  1. Foofoo
    Member
    Posted 9 years ago #

    Hi,

    I want to setup my blog (WP using Smarty tags) so that I have one post on the home page -- the latest post. That much I can do easy. But I want any comments posted in response to that post to also show up on the home page.

    Is there a way I can do that somehow?

    I tried various tactics but nothing seems to work.

    My content is displayed via the index.html template where there is a {$content} tag. I tried using an include statement to include the comments.html file, and it gets included all right but it won't show the user comments.

    Is there some way to use Smarty or inline PHP to get all the comments and display them?

    Any help would be greatly appreciated.

  2. klklaser
    Member
    Posted 9 years ago #

    http://www.coffee2code.com/
    has a function that may help you. I'm not certain if their "recent comments" can be sorted for a particular article, or not.

    Oh, here's a rough thought. Can you add the relevent code from wp-comments.php to your index.php? (if it can work, it'll require some time, no doubt)

  3. Foofoo
    Member
    Posted 9 years ago #

    I figured it out. Had to hack out some code from wp-comments, modify it accordingly (add globals, tweak parms, insert HTML, etc), and put it in the posts.html file -- plus I had to empty the comments.html file too (except for one line dummy line -- can't be totatlly empty) so that comments didn't show up twice when viewing posts. Also had to modify the post form, strip out Smarty and put in PHP code.

    Works now. Woooohoo!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.