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.

wordpress 3.3.2 hi. so i have this custom post type and i use a page to show just one post. url.td/page/

the page renders the post but now i want to include comments. if i allow comments for the page, the comments get assigned to the page, but i want it to get assigned to the post, for example url.td/page/my-post

if i disallow comments, the comments form is hidden.

this is my page

get_header(); ?>

<div id="primary">
    <div id="content" role="main">
        <?php
            $args = array( 'post_type' => 'charts', 'posts_per_page' => 1 );
            $loop = new WP_Query( $args );
            while ( $loop->have_posts() ) : $loop->the_post();
                get_template_part( 'content', 'charts' );
            endwhile;
        ?>
    </div><!-- #content -->
</div><!-- #primary -->
<?php get_footer(); ?>

and here comes my content-charts.php

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

lots of stuff here...

<?php 
    wp_reset_query();
    comments_template( '', true );
?>
</article><!-- #post-<?php the_ID(); ?> -->

so i thought, if the comments form is inside the post, it will be related to it, but it aint..

share|improve this question

2 Answers 2

untested - try and remove the wp_reset_query(); from content-charts.php; add wp_reset_postdata(); after the endwhile; into your page template.

share|improve this answer
    
nope, that didnt work. have a solution now, thanks!! –  honk31 Jun 5 '12 at 17:30

trail and error, right?

here is my dirty solution. in my content file i just recall the whole loop.

$args = array( 'post_type' => 'charts', 'posts_per_page' => 1 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
    comments_template( '', true );
endwhile;
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.