Show only if x comments?
wp_count_comments() returns the number of comments either for the whole blog or just for the current post. Example: if ( 10 < wp_count_comments( get_the_ID() )->approved ) echo ‘Wow, more than 10 comments!’;
wp_count_comments() returns the number of comments either for the whole blog or just for the current post. Example: if ( 10 < wp_count_comments( get_the_ID() )->approved ) echo ‘Wow, more than 10 comments!’;
The ability to set comment status is tied to the “edit_comment” capability, which is a meta-capability in WordPress. It maps to the “edit_post” capability, which is another meta-capability that varies depending on whether a post is published or not. In the end, if a post is published, then edit_comment ends up mapping to “edit_published_posts” for … Read more
The wp_list_comments() function uses the HTML comment list class Walker_Comment by default: A single comment is then displayed with the Walker_Comment::comment() method (#source). If the comment format is HTML5 then the Walker_Comment::html5_comment() is used instead (#source). The pingbacks are rendered with the Walker_Comment::ping() method (#source).
The function is_wp_error checks if the given var is an instance of WP_Error class (source code as WP 4.2.2): function is_wp_error( $thing ) { return ( $thing instanceof WP_Error ); } As you can see, if the given variable is a instance of WP_Error class, the function returns true, even if the object is empty. … Read more
In order to add a new comment you really only need a couple of fields and a POST method. In a typical comment form, requests are submitted to http://www.example.com/wp-comments-post.php which parses the $_POST data and sends it off to wp_handle_comment_submission. A POST method varies from a GET request in that params are usually sent in … Read more
Here you go, paste this code in your themes functions.php file: function loggedin_approved_comment($approved) { // No need to do the check if the comment is already approved anyway. if (!$approved) { if (is_user_logged_in()) { // Note: 1/0, not true/false $approved = 1; } } return $approved; } // Action allows the comment automatic approval to … Read more
Just incase if you have not checked out the plugin developers page but heres something that you could try if (function_exists(ckrating_get_comments)) { $post_id = $post->ID; $mycomments = ckrating_get_comments( “post_id=$post_id&status=approve& orderby=comment_karma&order=DESC”); } else $mycomments = null; wp_list_comments(array(), $mycomments); UPDATE I got it working placing in functions.php I got it working placing in functions.php `function comment_comparator($a, $b) … Read more
you can try adding this filter to your theme’s functions.php: add_filter(‘comment_form_default_fields’, ‘remove_url’); function remove_url($val) { $val[‘url’] = ”; return $val; }
Look at the function wp_delete_comment(). It fires an action before the comment is deleted: /** * Fires immediately before a comment is deleted from the database. * * @since 1.2.0 * * @param int $comment_id The comment ID. */ do_action( ‘delete_comment’, $comment_id ); … and one after deletion: /** * Fires immediately after a comment … Read more
Use: global $comment; $timestamp = strtotime(“{$comment->comment_date_gmt} GMT”); Regards.