Forums

Can I have two different comment.php templates? (9 posts)

  1. jessn
    Member
    Posted 3 years ago #

    I need to have two different comment templates, one for posts and one for pages. I got it to work well by just renaming comments.php to comments2.php and changing the link in the posts page. However now comments don't show up. Did I forget to do something else? Is it even possible to have different comments templates?

  2. Eric Amundson
    Member
    Posted 3 years ago #

    Hey Jessn,

    I believe you can - check this:

    http://wordpress.org/support/topic/164787?replies=3

  3. jessn
    Member
    Posted 3 years ago #

    Yep that's exactly what I did, and no comments are showing up although they're there.

  4. jessn
    Member
    Posted 3 years ago #

    Ah, got it. I needed it to be different widths because of the way the pages/posts are laid out, but I just wrapped the post comment form in a div with a specific width and that worked great. Thanks for your reply!

  5. Eric Amundson
    Member
    Posted 3 years ago #

    No worries! :) Glad you got it working.

  6. polle001
    Member
    Posted 3 years ago #

    Hey Jessn or someone else that knows how.

    I have that exact problem, the comments does not show up.

    It says there are 2 comments but the comments are not visible, just the form to post another one.

    How do yo fixed it ? I cant find that post comment form you mentioned, can you be more precise in the fix please ?

    I am using WP 2.7 default theme.

    Also, is it needed to change the first line in the comments2.php file ?

    This>
    if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))

    need to have comments2.php ? or its ok as it is ?

    Thanks.

  7. Otto
    Tech Ninja
    Posted 3 years ago #

    Stop bumping. Bumping is not allowed in these forums.

    Also, the correct way to call a different comments file (like comments2.php) is to do this in your page template:
    comments_template('comments2.php');

  8. tinkerdomino
    Member
    Posted 3 years ago #

    Hi

    I really need some help with this: I have 2 comments templates. I have called my different comment file using the above method, from a page that I have set up for a specific category (category-62.php). The problem is, it seems to call up a default comment form (and not the different comment file - it is different to my comment file that I already have). I cannot change anything on it. Can anybody please tell me what could be the problem.

  9. jhampton
    Member
    Posted 3 years ago #

    I just had the same issue. I figured out after a bit of troubleshooting that when I changed the call to comments_template('comments2.php'); it didn't really use the comments2.php file. Instead, it used the comments.php from the default template. So basically, my workaround was to just edit the comments.php file from the default template instead. Not the best workaround, but at least it works and i can have two separate comment files.

Topic Closed

This topic has been closed to new replies.

About this Topic