0

Hi: I have been using the comments.php, comments-popup.php, single.php and loop from the Kubrick theme to create my blog functionality in themes I build from scratch. But with WP 3.0 there's a new approach and I can't quite get it to work. From what I've gathered I have the loop in the index.php, loop with some additional code in the single.php, a category.php, and in the comments.php all there should be is one line of code: <?php comment_form(); ?>

On the server there's a wp-comments.php page with what appears to be the various parameters that can be adjusted - though how to do that is another question. But my first question is: what exact templates and code are needed to get basic fully functioning comments? Do I have to add anything to the functions.php?

I almost got there but I couldn't get comments to actually appear on a page. I had the ability to enter comments working, and the comments would come into the admin, and the live page itself would have a link: 1 comment. But clicking the link took me nowhere.

I'm using the loops etc. from this article: http://www.onextrapixel.com/2011/03/08/how-to-code-a-wordpress-3-0-theme-from-scratch/

Can someone enumerate the specific steps to make the new approach work? I'm an HTML/CSS person who understands a little php but not a lot. I'm trying to grasp the relationship between all the pieces/parts needed to make the comments work with the new approach.

Thank you for any help!

1

1 Answer 1

1

Just download twentyten and see how it works, it's relatively simple to use it as an example. Nothing needs to go into functions.php for comments to work. You can use custom callbacks in there if you wish, but just a few template tags get the comments going

<?php comments_template( '', true ); ?>

Is what goes into your single.php, page.php etc to disply the form. http://codex.wordpress.org/Function_Reference/comments_template

Something like

<p><?php comments_popup_link('No comments yet', '1 comment so far', 
'% comments so far (is that a lot?)', 'comments-link', 'Comments are 
off for this post'); ?></p>

Is great for index.php http://codex.wordpress.org/Function_Reference/comments_popup_link

And then within comments.php, wp_list_comments displays the comments, and yes,

<?php comment_form(); ?>

Is what displays the actual form

I like this article for usage of the comment form

3
  • Hi: Thanks for responding, Rev! I wanted to ask a follow-up but there doesn't seem to be room -
    – PVA
    Commented May 25, 2011 at 19:18
  • If <?php comments_template( '', true ); ?> ISN'T in my loop in the index.php, do I need to add it?
    – PVA
    Commented May 25, 2011 at 19:32
  • My apologies, I just realized I was not so clear. The comments template is for use on single and page views. comments_popup_link is the best way for index.php codex.wordpress.org/Function_Reference/comments_popup_link As you can probably guess, the popup link links to your comment template on the single post view, and comments_template is what calls in comments.php. I revised my original answer to hopefully be a bit more clear Commented May 25, 2011 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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