How to get comments other than using wp_list_comments?

This is going to be a labor intensive workaround but get_comments is probably what you want. From the Codex: $comments = get_comments(‘post_id=15’); foreach($comments as $comment) : echo($comment->comment_author); endforeach; There is also WP_Comment_Query if you prefer.

Insert Ads “into” comments section in Genesis Themework

I would use the Genesis Simple Hooks plugin which allows you to add code to Genesis Comment Form hook. I’m using Hostgator ads for this example, but adsense can be used too. I dropped this code <a href=”http://secure.hostgator.com/~affiliat/cgi-bin/affiliates/clickthru.cgi?id=brilliantpamela-” style=”float:right; margin: 4px 3px;”><img src=”http://tracking.hostgator.com/img/Discount_Shared/Hostgator-new-_AN-125×125.gif” border=”0″></a> into The simple hook action only allows you to place code … Read more

Display avatar with comment form?

I’ll answer myself. Add the following somewhere in functions.php or make it into a plugin: add_action( ‘comment_form_logged_in_after’, ‘psot_comment_form_avatar’ ); add_action( ‘comment_form_after_fields’, ‘psot_comment_form_avatar’ ); function psot_comment_form_avatar() { ?> <div class=”comment-avatar”> <?php $current_user = wp_get_current_user(); if ( ($current_user instanceof WP_User) ) { echo get_avatar( $current_user->user_email, 32 ); } ?> </div> <?php }

Disable comments and pingbacks on old custom post types

Let’s make it easier. I want to disable comments and pingbacks everywhere in all single posts, custom post types and pages both new and old. You could remove comment support for your post types. remove_post_type_support( ‘posttype’, ‘comments’ ); // for each of your post types of course The same can be done when registering the … Read more

Show comment pop up links as text only

For that matter, don’t use comments_popup_link(). Use comments_number() instead. This has the same function but not linked. <?php comments_number( ‘no responses’, ‘one response’, ‘% responses’ ); ?>

Disable only the comment form/box itself?

The comments_open() function is used, both by core and typically themes to determine status for specific post. It has filter of same name for result, which you can use to manipulate it individually for the post. comment_form() won’t actually output form if check is false and fire comment_form_comments_closed action in such case. Native WP themes, … Read more

Way to count the number of people who have commented on a post?

You could try to count the number of unique comment author emails per post: /** * Number of unique comment author emails per post: * * @see http://wordpress.stackexchange.com/a/168606/26350 * @param int $pid * @return int */ function get_unique_commenters_by_post_id( $post_id ) { global $wpdb; $sql = “SELECT COUNT(1) as uc FROM ( SELECT COUNT(1) as c … Read more

How can I count only guests comments?

You can use these inside the loop, or in comments.php //The author of current post $author_ID = get_the_author_meta(“ID”); //The current post ID $p_ID = get_the_ID(); //Number of guest comments echo count(get_comments(array( ‘post_id’ => $p_ID, ‘author__not_in’ => array($author_ID) ))); More: https://codex.wordpress.org/Function_Reference/get_comments