0

We've integrated a WP instance into our website, and I was wondering how to render the comments template into the page.

I've tried simply adding:

    comments_template( '', true );

But it doesn't seem to work (also there are no errors shown).

I guess we are missing some includes and inits. Any help would be appreciated.

  • Do you have a comments.php file in your theme? – Howdy_McGee Jul 28 '14 at 16:33
1

Could be as simple as using the full function in the template file:

<?php comments_template( '', true ); ?>

Be sure you have a comments.php file in the theme folder.

And be sure you're using the full loop:

<?php
require('/the/path/to/your/wp-blog-header.php');
?>

<?php
$posts = get_posts('numberposts=10&order=ASC&orderby=post_title');
foreach ($posts as $post) : setup_postdata( $post ); ?>
<?php the_date(); echo "<br />"; ?>
<?php the_title(); ?>    
<?php the_content(); ?>

<?php comments_template( '', true ); ?>

<?php
endforeach;
?>

See Integrating WordPress with Your Website « WordPress Codex

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.