Make wordpress comments work with include templatepath

How can I make the wordpress comments work with:

include(TEMPLATEPATH."/comments.php");

instead of:

Read More
comments_template( '', true );

Ay ideas? Ty

Related posts

Leave a Reply

2 comments

  1. Short answer: you can’t.

    Longer answer:

    You can include comments.php as a template-part file inside another template, via:

    get_template_part( 'comments.php' )
    

    …but that won’t actually make comments work, because the comments_template() template tag does far more than merely include the comments.php template-part file. In order to make comments actually work when using get_template_part() as opposed to comments_template(), you’d need to duplicate all of the functions performed by comments_template(). And if you need to duplicate all of that code in order to make comments work, you might as well just use the function itself.

  2. That wont work because we cannot include the comments.php file as a template file. Our comments.php file doesn’t contain the necessary codes to do SQL operations on database and fetch the comments to display.

    So instead including that file as a template file we should call the function comments_template() to show the comments.

    WordPress uses comments_template() function to get the file and display the comments, if we don’t provide file variable wordpress uses default comments.php to process the result.

    Note –

    If you’re curious about how to load a different comment template then here’s the code

    <?php comments_template( '/comments2.php' ); ?> 
    

    Reference – Comments_template