A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

New answers tagged

0

you can paste the code below in your theme functions.php file, it should generate almost the same comment form for logged in and logged out users add_filter( "comment_form_fields", function( $comment_fields ) { if( is_user_logged_in() ) { // Get an array of field names, excluding the textarea $comment_field_keys = array_diff( array_keys( ...


1

To achieve this, you should filter the manage_edit-comments_columns filter to remove the core comment column, and add a custom comment column so the checkbox shows up in the screen options tab. For the output of comments, you would then need to get comment_content from the comment for display output in the manage_comments_custom_column hook. This is an ...


0

Here's another method in case you want to check if a comment has replies (children) within a get_comments() query. (You would likely not want to use birgire's method inside of a get_comments() query since you would be doing a get_comments() query inside of another get_comments() query. My method is to use the WP_comment_query class's get_children() method: ...


0

Currently, it looks like you are looping through comments and then querying the posts from there. Could you use the comment_count order by parameter directly in the posts query itself? For example: <?php $post_args = array( 'post_type' => 'portfolio', 'posts_per_page' => 1, 'orderby' => 'comment_count' ); $posts = get_posts($...


0

Try with array method, using reply post type with its parent. <?php $args = array( 'post_type' => 'reply', 'status' => 'approve', 'post_parent' => $postID, 'posts_per_page' => 50, 'orderby' => 'date', ...


1

it depends on the theme, but in general Comments are generated by the template : comments.php , you found something like that (example) : <?php $dro_pizza_comment_count = get_comments_number(); if ( '1' === $dro_pizza_comment_count ) { printf( /* translators: 1: title. */ esc_html__( 'One thought on &ldquo;%...


0

Your code uses this: number_format((float)$results[$i]['avg_rate'], 2, '.', '') And if we look at where $i is set, we see this just before the loop: $i=0; and this: $i++; But I don't see how this maps in any way to the current post when there's a conditional, meaning that not everything in the results array is included in the post query. ...


0

The best solution is to use the filter hook associated with that particular output // Remove the author says from the comment. add_filter( 'comment_author_says_text', '__return_false' );


Top 50 recent answers are included