After submit comments select the current tab

i think the best solution is to add an get attribute, in this case we don’t need javascript like this: your single.php : <div id=”product-information”> <div id=”tabs” class=”htabs”> <a href=”https://wordpress.stackexchange.com/questions/115110/<?php the_permalink(); ?>&tab=description” class=”<?php echo !isset($_GET[‘tab’]) || ($_GET[‘tab’] == ‘description’) ? ‘selected’:”; ?>”>Description</a> <a href=”<?php the_permalink(); ?>&tab=comment” class=”<?php echo isset($_GET[‘tab’]) && ($_GET[‘tab’] == ‘comment’) ? ‘selected’:”; … Read more

How to get the number of pages when paginating comments?

Try get_comment_pages_count()? <?php get_comment_pages_count( $comments, $per_page, $threaded); ?> I’m guessing you’re outside the loop, since you’re calling get_comments(); in that case, you’ll need to pass your $comments object: $comments = get_comments(array( ‘post_id’ => $post_id, ‘status’ => ‘approve’ )); wp_list_comments(array( ‘page’ => 1, ‘per_page’ => 10, ‘avatar_size’ => 16, ), $comments); $comment_page_count = get_comment_pages_count( $comments );

How can I grab and show the reader comments of my site

Sohag, you are seeking get_comments(). See the Codex. <?php $args= array( ‘author_email’ => ”, ‘ID’ => ”, ‘karma’ => ”, ‘number’ => ”, ‘offset’ => ”, ‘orderby’ => ”, ‘order’ => ‘DESC’, //ASC or DESC ‘parent’ => ”, ‘post_id’ => 0, ‘post_author’ => ”, ‘post_name’ => ”, ‘post_parent’ => ”, ‘post_status’ => ”, ‘post_type’ => … Read more

comments_popup_link() – how to load different classes/images according to different comment condition?

Use get_comments_number() to determine the number of comments, and prepare the CSS class with that information: $css_class=”zero-comments”; $number = (int) get_comments_number( get_the_ID() ); if ( 1 === $number ) $css_class=”one-comment”; elseif ( 1 < $number ) $css_class=”multiple-comments”; comments_popup_link( __( ‘Post a Comment’, ‘your-theme’ ), __( ‘1 Comment’, ‘your-theme’ ), __( ‘% Comments’, ‘your-theme’ ), $css_class … Read more

Display custom text when comments are closed

If you go to comments.php in your theme – and search for “Comments are closed”, you should find it. You should also be able do this in functions.php: function comment_text ($arg) { $arg[‘title_reply’] = __(‘Too Late – Comments are Closed!’); return $arg; } add_filter(‘comment_form_defaults’,’comment_text’); Edit: Just noticed that you want this to work cross theme. … Read more

unapprove comments on custom post type

You should be able to write a function that fetches all comments by comment type using get_comments(), then loop through them and set status using wp_set_comment_status(). e.g. Retrieve all comments associated with posts in the debate post type: $debate_comments = get_comments( array( ‘post_type’ => ‘debate’, ‘status’ => ‘approve’ ) ); Loop through each one, and … Read more