• Hello. I’m using a custom query on my homepage to bring back the latest post. I need to bring back the latest 3 comments from the latest post but nothing is displaying. Current code:

    <div class="main">
    
    			<?php
                $temp = $wp_query;
                $wp_query= null;
                $wp_query = new WP_Query();
                $wp_query->query('showposts=1'.'&paged='.$paged);
                ?>
                <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
                  <article class="post">
    	    		<header  <?php post_class() ?> id="post-<?php the_ID(); ?>">
    	    			<h1><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
                        <small><time datetime="<?php the_time('Y-m-d') ?>" pubdate><?php the_time('F jS, Y') ?></time> by <?php the_author_posts_link(); ?>.</small>
                    </header>
                    <div class="entry">
                    <?php the_excerpt(); ?><?php wp_list_comments('type=comment&callback=mytheme_comment'); ?>
    
                    </div>
                  </article>
                  <!-- end .post -->
    
        	</div>
        	<!-- end .main -->
    
    			<aside class="secondary">
    		    	<section class="mod">
    		    		<h3>Recent Comments</h3>
                        <ul class="commentlist">
                        <?php wp_list_comments('type=comment'); ?>
                        </ul>
    
                 <?php endwhile; ?>
    
                <?php $wp_query = null; $wp_query = $temp;?>

    I’ve also tried get_comments and various plugins but can’t get anything to pull through. Any idas? Thanks

  • The topic ‘show comments on homepage’ is closed to new replies.