How can I add comments to a page?

Have you checked under Admin -> Settings -> Discussion and for individual pages, under pages and quick-edit or the discussion area in edit page below the page editor? When the last one does not show, click screen options near the top right, and tick discussion there, then scroll back down.

Get comments for more than one post

The ‘post_id’ is converted to a positive integer in WP_Comment_Query, so you cannot successful pass anything else to get_comments(). You have to filter ‘comments_clauses’. Here you can change the WHERE clause to use comment_post_ID IN ( $ids ) instead of comment_post_ID = $id. I would use a static class as a wrapper for get_comments(). Sample … Read more

Reverse comment pagination numbers

i’ve used wp_list_comments like this: <?php if (class_exists(‘Walker_Comment_Wink’)) $walker = new Walker_Comment_Wink(); else $walker=””; wp_list_comments(array(‘walker’ => $walker, ‘type’ => ‘comment’ , ‘callback’ => ‘theme_comment2’)); ?> i used the plugin http://winkpress.com/articles/fix-reversed-comments-pagination/ to fix the “* and 1 comment” weirdness. You have the option to pass $reverse_top_level (boolean) (optional) Setting this to true will display the most … Read more

What’s the easiest way to close comments on media/attachments?

This ought to do it: function wpse15750_comment_check( $id ){ if( get_post_type( $id ) == ‘attachment’ ) exit; } add_action( ‘pre_comment_on_post’, ‘wpse15750_comment_check’ ); EDIT Ignore the above. That will stop new comments, but to do what you want, this is much better: function wpse15750_comments_closed( $open, $id ){ if( get_post_type( $id ) == ‘attachment’ ) return false; … Read more

Comment visibility

By using the ‘pre_get_comments’ action, found in wp-includes/comment.php: function restrict_visible_comments( $comments_query ) { if ( !is_singular() ) return; if ( current_user_can( ‘moderate_comments’ ) ) return; // moderators can see all comments if ( get_current_user_id() == get_queried_object()->post_author ) return; // the author of the post can see all comments $comments_query->query_vars[‘user_id’] = get_current_user_id(); } if ( !is_admin() … Read more

How to use a custom comments template

The comments_template() template tag sets up the commenting variables and functions, and includes the comments.php template-part file. So, to create a custom comments template, use comments.php. From there, you will need to get comfortable with the arguments, filters, and callbacks for wp_list_comments(), which is used to output the comment list, and comment_form(), which is used … Read more

One comment per user per post but be able to reply to existing comments

So after some time I done exactly what I wanted and I thought it would be nice to share. So in functions.php add function c_parent_comment_counter($pid,$uid){ global $wpdb; $query = “SELECT COUNT(comment_post_id) AS count FROM $wpdb->comments WHERE <code>comment_approved</code> = 1 AND <code>comment_post_ID</code> = $pid AND <code>user_id</code> = $uid AND <code>comment_parent</code> = 0”; $parents = $wpdb->get_row($query); return … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)