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.

My home.php is associated with my blog page, as opposed to rest of site which is just a cms. I want my blog page to render the comments ability, an archive of older posts, tags, blogroll, etc. Right now, this is what I have in my home.php:

<?php
/*
Template Name: Home
*/
?>
<?php get_header(); ?>
<?php
    $blog_query = new WP_Query;
    $blog_query->query( 'post_type=post' );
?>
<div id="post-content">

<?php echo "Blog updated daily" ?>

<?php if( $blog_query->have_posts() ) : ?>

    <?php while( $blog_query->have_posts() ) : $blog_query->the_post(); ?>

    <div class="post">
        <h2 id="post-<?php the_ID(); ?>"><?php the_title();?></h2>
        <?php the_content(); ?>
    </div>

    <?php endwhile; ?>

<?php endif; ?>

<?php wp_reset_query(); ?>

</div>
<?php get_footer(); ?>

Problem is obviously, this just rendering the posts, but not the comment section or anything else. How can I inherit the wordpress defaults so that it will display the comment section and so forth? Right now If i was to remove that code above, the page would be blank.

share|improve this question
3  
This question should be titled 'how do I display comments on a post?', to which the answer is found in the default theme twentyten/eleven –  Tom J Nowell Sep 7 '12 at 23:03

1 Answer 1

Easiest thing to do is look at twentyten or twentyeleven - each one a default WordPress theme - and see how comment functions are implemented in those. basically, it's a comments.php file, a function in functions.php and a function call in a theme file, i.e. like your home.php.

You may have to revert to the standard WordPress loop, too, instead of the new query, which in your case has no advantages over the standard loop. There's nothing out of the ordinary in your home.php file.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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