Articles of get comments

Getting comments of an specefic user

i am using this code: $args = array( ‘user_id’ => get_current_user_id(), ); $comment = get_comments( $args ); var_dump($comment); wp_list_comments(“callback=wpsaz_comment&end-callback=dubfa_div&per_page=5”,$comment); i dont know what is wrong with it. user is logged in but the array is empty. whats wrong ?

Get comments only for certain specific users in template file

To return comments for a specific user, I use the code below: $arg = array(‘user_id’ => $userID); $coms= get_comments( $arg ); How can I modify the arguments of this function so that I get comments for a group of users (get only comments for specific 2 or 3 users)? The arguemnt ‘user_id’ should be an […]

How to get posts and comments amount per hour, per year and per month?

I have this snippet: function count_user_comments_today( $uid ){ global $wpdb; $today = date(‘Y-m-d’); $tomorrow = date(‘Y-m-d’, time() + 86400); $count = $wpdb->get_var( $wpdb->prepare(“SELECT COUNT(*) FROM {$wpdb->comments} WHERE user_id = %d AND comment_date >= %s AND comment_date < %s “, $uid, $today, $tomorrow )); return $count; } But this get’s the comments per day and that […]

Change WordPress comments url / word

Is this possible? For example, I want to change http://mysitesitesite.com/post-name/comment-page-1/#comment-452 to http://mysitesitesite.com/post-name/custonname-1/#customname-452 What should I do to get it working? Is there any chance to fix this?

How to exclude the child comments in get_comments() query?

How do I only get the first level of comments in get_comments() or WP_Comment_Query? I want to query the comments which have ‘comment_parent’ => 0, and exclude all the child comments. $args = array( ‘number’ => 10, ‘order’ => ‘DESC’, ‘status’ => ‘approve’, ‘meta_key’ => ‘comment_parent’, ‘meta_value’ => 0 ); $comments = get_comments( $args );

Comment Link from get_comments()?

I’ve got to update a bit of sloppy code that shows the 5 most recent comments across the entire blog. The code is using WordPress’ get_comments() method, which doesn’t appear to return comment id’s, or comment links (direct links to comments within posts via the hash-tag). How can I collect more information about the particular […]

Show comment number per author per day

Is this possible? I’ve never seen it used, but I need it… I want to show for each author (if they are logged in) on their own profile page, the amount of comments they have posted today. If the day passes by, than the counter has to be 0 and the comment counter has to […]

Getting comment count per post not working

I have this function: <?php $popular = new WP_Query(‘orderby=comment_count&posts_per_page=5’); ?> <?php while ($popular->have_posts()) : $popular->the_post(); ?> <li><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a> </li> <?php endwhile; ?> Where I added $popular->wp_comment_count, but it did not work at all. How do I do this? I want to let see the comment count per post…

get_comments not working consistantly with post_id

I am trying to get comments from another post. I am getting the post_id and doing a check to see if it has comments I can get the comments for the current post every time but for the other post I am getting mixed results (I did get it working but am unable to reproduce […]

Comment number does not increment

I am making a custom wordpress theme and when I add a comment to a post and retrieve the number of comments using get_comments_number() the number does not change. I do know the function works because for the first comment that gets preinstalled with wordpress it returns 1. but somehow the number does not increment […]