I'm simply typing wp_list_comments() in page.php but nothing is shown. But if I put the comments_template() tag there, then the comment form, comments and pings are shown. Why is that, why can't I use wp_list_comments() in page.php? What could I have done wrong?
You need to include comments functionality via
comments_template(), because this function doesn't merely include the
comments.php, file, but also handles all of the querying and functions required for displaying comments.
<?php /** * Loads the comment template specified in $file. * * Will not display the comments template if not on single post or page, or if * the post does not have comments. * * Uses the WordPress database object to query for the comments. The comments * are passed through the 'comments_array' filter hook with the list of comments * and the post ID respectively. * * The $file path is passed through a filter hook called, 'comments_template' * which includes the TEMPLATEPATH and $file combined. Tries the $filtered path * first and if it fails it will require the default comment template from the * default theme. If either does not exist, then the WordPress process will be * halted. It is advised for that reason, that the default theme is not deleted. * * @since 1.5.0 * @global array $comment List of comment objects for the current post * @uses $wpdb * @uses $post * @uses $withcomments Will not try to get the comments if the post has none. * * @param string $file Optional, default '/comments.php'. The file to load * @param bool $separate_comments Optional, whether to separate the comments by comment type. Default is false. * @return null Returns null if no comments appear */ ?>