Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Hello I would like to know if there is a way to pull the contents of comments on a post to a separate page from wordpress. currently this is what i have, i'd like to replace with a function to pull the comments instead of pulling the link to the comments.

<?php
// Include Wordpress 
define('WP_USE_THEMES', false);
require('./blog/wp-load.php');
?>
<div>
<p style="font-size:18px;color:white;font-wieght:700;">Recently Asked Questions</p>
<?php query_posts('showposts=3'); ?>
<?php while (have_posts()): the_post(); ?>
<div id="faq">
<a href="<?php the_permalink() ?>"><?php the_title() ?></a><br />
<?php the_time('F jS, Y') ?>
<?php the_excerpt(); ?>
<?php comments_popup_link(); ?>
To see the answer to the question click <a href="<?php the_permalink() ?>">here</a>.<br /><br />
</div>
<?php endwhile; ?>
</div>

Any help is appreciated, thank you.

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

add to your loop and replace it with the the_permalink() function something like this:

<?php
// Include Wordpress 
define('WP_USE_THEMES', false);
require('./blog/wp-load.php');
?>
<div>
<p style="font-size:18px;color:white;font-wieght:700;">Recently Asked Questions</p>
<?php query_posts('showposts=3'); ?>
<?php while (have_posts()): the_post(); ?>
<div id="faq">
<a href="<?php the_permalink() ?>"><?php the_title() ?></a><br />
<?php the_time('F jS, Y') ?>
<?php the_excerpt(); ?>
<?php comments_popup_link(); ?>
<?php comments_template( '', true ); ?>
<br />
</div>
<?php endwhile; ?>
</div>
share|improve this answer
add comment

Use get_comments() - http://codex.wordpress.org/Function_Reference/get_comments

<?php 
$comments = get_comments('post_id=15');
foreach($comments as $comment) :
    echo($comment->comment_author);
endforeach;
?>
share|improve this answer
add comment

protected by toscho Jul 23 '12 at 11:07

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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