External link not showing on post but showing on comment
External link not showing on post but showing on comment
External link not showing on post but showing on comment
If you use the comment_class function to add classes to each comment, comments by the post’s author can be styled via the bypostauthor class. You can alternately match the comment ID against the post ID: global $post; if( $comment->user_id === $post->post_author ) { // is author comment }
Does not show comment list
Editing your code to use a custom field is fairly trivial… function close_comments( $posts ) { if ( !is_single() ) { return $posts; } $cmeta = get_post_meta($posts[0]->ID,’your_field_name’,true); if ( $posts[0]->post_date_gmt < $cmeta ) { $posts[0]->comment_status=”closed”; $posts[0]->ping_status=”closed”; } return $posts; } add_filter( ‘the_posts’, ‘close_comments’ ); I am not sure that that approach is the right one … Read more
You can hook comment_post and add your logic with the comment id // Save the data along with comment id add_action( ‘comment_post’, ‘wti_save_comment_data’ ); function wti_save_comment_data( $comment_id ) { // Use the comment id and add your logic }
Try this <?php echo get_comments_number( $post[‘ID’] ); ?>
I do not see the $comment_ID variable having any value in your code. So try by changing the following code wp_notify_postauthor($comment_ID, $comment->comment_type); to wp_notify_postauthor($comment->comment_ID, $comment->comment_type); You can also remove $comment->comment_type as per codex
Comments orderby comment date not working
Listing comment author role code problem
For this you can use WP_Comment_Query. The query will be $comments_query_args = array( ‘post_type’ => ‘post’, ‘number’ => 5, ‘status’ => ‘approve’ ); $comments_query = new WP_Comment_Query(); $recent_comments = $comments_query->query($comments_query_args);