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.

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!

share|improve this question
    
See What are the current recommended best-practices for comments.php? – possible duplicate. –  toscho May 25 '11 at 17:44

1 Answer 1

up vote 1 down vote accepted

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

share|improve this answer
    
Hi: Thanks for responding, Rev! I wanted to ask a follow-up but there doesn't seem to be room - –  PVA May 25 '11 at 19:18
    
If <?php comments_template( '', true ); ?> ISN'T in my loop in the index.php, do I need to add it? –  PVA May 25 '11 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 –  Rev. Voodoo May 25 '11 at 20:16

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.