• Resolved heriksson

    (@heriksson)


    Hi all,

    I’m trying to get the comment template to display on the front page (in the new Twenty Ten theme) for every post in the loop but I’m unable to get it working. I thought that this was just a matter of adding the following code after each post is rendered in loop.php but it doesn’t produce any output:

    <?php
    $withcomments = 1;
    comments_template();
    ?>

    Is anyone here able to tell me what I’m doing wrong?

    Thanks!

    /Hans

Viewing 15 replies - 1 through 15 (of 17 total)
  • try this <?php comments_template( '', true ); ?>

    or

    <?php
    wp_list_comments( array( 'callback' => 'twentyten_comment' ) );
    ?>
    Thread Starter heriksson

    (@heriksson)

    Thanks for the reply Chinmoy! Still no luck though ?? It won’t give me any output. I am able to access other functions for the posts in the loop but not this particular one (which I badly need) …

    /Hans

    seems to be working with this code in line 153 of loop.php:

    <?php global $withcomments; $withcomments = 1; comments_template( '', true ); ?>

    for some reason, it needs the global $withcomments; with the known fix.

    Thread Starter heriksson

    (@heriksson)

    Yes, that did the trick! You just made my day alchymyth! ?? Thank you both!

    /H

    how to count lines while editing..
    do you count it in Notepad++ or anything else.?

    Hi,

    I am trying to do the same thing, the website is https://www.glasgowunilacrosse.com, and I have tried editing loop.php, but with no sucess. The bit of the loop I have edited now looks like this:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    I have also tried using the show/hide comments from scriptygoddess, and have installed her two plugins, but I still need to add some line into the post page to get the comments to show. Any help would be great.

    Thanks.

    I have had another bash at this after finding this site.

    It shows you where in the twenty ten theme to make the changes. So I now have my loop.php looking like this…

    <script src=”https://pastebin.com/embed_js.php?i=WjSELKu9″&gt;

    Hmm, pastebin, do I now need to register for another forum on how to use pastebin?!?!

    Anyway, it looks exactly like the bottom example on the transformation power tools site. I ahve also tried making it look exactly like the example from Alchymyth above. No joy.

    All that has happened is that the link for leaving a comment has disappeared, the comments still dont show. I am using WP 3.0.1, and I know i should update, but there is not enough room on my server at the moment.

    Ok, so looking at line 857 in comment-template.php, the IF statement with all the OR’s in it, I understand some of what the tansformation power tools site is getting me to do. f I read it right, the comments IF statement says it wont show comments if the post is not on a single post page, or if it is not a page, or if withcomments is not true, or if the post is empty.

    So, the !(is_single OR is_page OR $withcomments) bit, if anything in the brackets is true, then the whole bit in the brackets is true, in which case the !() is false. Then if the empty($post) is also false, then the rest of the comments_template function will run and the comment will be displayed.

    So the <?php global $withcomments – creates the global variable withcomments, and setting this to true should stop the IF statement in comments_template.php from exiting the function that adds the comments and the comments form to the post.

    Yes/no?

    If so, I dont understand why my comments are not now showing.

    ANY help would be great, thanks.

    Why are you looking at core code?

    Because when I search for solutions to my problem, this is the solution that is repeatedly presented.

    No. The file being discussed is the comments_template file – which defaults to the comments.php template file in your theme.

    Don’t edit core files.

    Esmi,

    thanks for helping me out, but there is no need for the heavy tone. The top post in this topic clearly states “adding the following code after each post is rendered in loop.php”, as does the website instructions I have pointed to “code to edit in loop.php around line 160”.

    Thanks for linking my new post to this one.

    there is no need for the heavy tone

    Perhaps you’re reading more into the text of my reply than was ever intended.

    The top post in this topic clearly states “adding the following code after each post is rendered in loop.php”

    I’m not sure what that has to do with editing core files. loop.php is a theme template file.

    “I’m not sure what that has to do with editing core files. loop.php is a theme template file. “

    I think you have just read my last post without reading the rest of the topic and got the wrong idea. I dont know what files are core files and which are not.

    I have only edited loop.php as described in this post and the website I have linked, but both ways don’t work for me.

    Any pointers would be great,

    Thanks.

    it seems that you are using a plugin for the comment form (?)

    which one? (name/download link)

    try de-activating it and see if this changes something.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Twenty Ten: comments on front page’ is closed to new replies.