Forums

Comments not working ?? (7 posts)

  1. Mark
    Member
    Posted 6 years ago #

    Hello :)

    I have a loop bringing the content of an article into my single.php template.

    Then i have 3 commands.... one to display categories, a loop to display other articles and a recent comments command...

    then under that in the html (but css'd to diplay along side the main article in a right-hand column), is the comments_template.

    my problem is that the comments template is displaying comments from a different article. i'm sure it has something to do with the loops inbetween the end of the article and the comments template, altho i'm not sure how 2 remedy this...
    all this can be seen here: http://tools.handcraftedserver.net/wordpress/?p=8 , for example...

    my code looks like this:
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <h2><?php the_title(); ?></h2>
    <p id="small"><small>Written by <?php the_author() ?></small>
    <?php the_content(''); ?>
    <?php endwhile; endif; ?>

    then i have the 3 other commands like so:

    the categories

    <ul>
    <?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0'); ?>
    </ul>

    the recent comments


    <ul>
    <?php bdp_comments(); ?>
    </ul>

    and then the other articles

    <ul>
    <?php $posts = get_posts('numberposts=10'); foreach ($posts as $post) : setup_postdata($post); ?>
    <?php if ( in_category(7) ) {} else { ?>
    <li><a href= "<?php the_permalink() ?>"><?php the_title(); ?></a></li>
    <?php } endforeach; ?>
    </ul>

    then after that, i have the comments_template

    <?php comments_template(); ?>

    i look forward to getting some help from you guys.. thank you

  2. Mark
    Member
    Posted 6 years ago #

    ...just wanted 2 refresh this query so that it didn't get lost in sunday's doldrums :)

    would really appreciate some help with this...
    thank you :)

  3. Mark
    Member
    Posted 6 years ago #

    hey guys... is no one able to solve this problem... ?
    :(

    ...here's hoping someone can give me some help...

  4. moshu
    Member
    Posted 6 years ago #

    Well, normally the call for the comments template is inside The_Loop - so that WP "knows" how to query the comments for the post.

  5. Mark
    Member
    Posted 6 years ago #

    Yeah, that much i've figured out, thanks moshu. Is there not a way to perhaps pause the loop, run those other commands and then re-instate it?

    Alternatively, is there not a command that can tell the comments_template which comments to display? Perhaps a php command that will use the url to determine the correct comments...? Just a thought.....?

  6. moshu
    Member
    Posted 6 years ago #

    The only theme I know of having the comments in the sidebar - is Greenery, see here:
    http://me.mywebsight.ws/web/wpthemes
    Download, dissect... see how it was done.

  7. Mark
    Member
    Posted 6 years ago #

    thanks moshu, i tried that but even though the comments are on the side, there's no other commands or queries between the article loop and the comments loop...

    if i remove the stuff in between my article & comments loop, it all works fine... its the stuff in between thats causing the problemsh..

    got ya'll stumped?? :D

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags