WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] comments_template not working on single.php (4 posts)

  1. techpavan
    Member
    Posted 5 years ago #

    Hi,

    I am a blogger at http://www.techpavan.com.

    I am working on a new theme for my blog and came with a small problem and need a solution about that.

    I use domtab on single.php and am displaying popular, related and featured posts in the domtab. Related and Popular posts are been displayed using plugins yarpp and popularity contest. No problem with those.

    Coming to the problem.
    To display featured posts, I am using wp query code as below.

    <?php $my_query = new WP_Query('cat=46 &showposts= 10');
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID; ?>
    <p><ol><li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></li></ol></p>
    <?php endwhile;?>

    After this domtab, I am placing my comments_template(); part.

    The problem lies here - As I have used database query to display featured posts, it seems my normal post id is lost and the LAST POST'S (from featured list) POST ID IS USED TO DISPLAY COMMENTS. This is resulting in the comment section of the bottommost featured post.

    I googled on the problem and found one good result here:
    http://www.mydigitallife.info/2006/06/24/retrieve-and-get-wordpress-post-id-outside-the-loop-as-php-variable/

    but I am not able to understand where to declare $id global and how to code near comments_template part.

    Kindly help me in a clear way as I am not a very good coder.

    Your help is appreciated. Thank you :)

  2. techpavan
    Member
    Posted 5 years ago #

    waiting for solution... kindly help :)

  3. techpavan
    Member
    Posted 5 years ago #

    could anyone fix it... ?

  4. techpavan
    Member
    Posted 5 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic