How to get recent comment link

Try this code , you have not used the correct output variables. <?php $recent_comments = get_comments(‘status=approve&number=5′); ?> <?php foreach ($recent_comments as $comment) { ?> <li> <a href=”#”><?php echo get_avatar( $comment, ’60’ ); ?> </a> <div> <a href=”<?php echo get_permalink($comment->comment_post_ID); ?>” title=”on <?php echo get_the_title($comment->comment_post_ID); ?>”><?php echo strip_tags($comment->comment_author); ?> </a><br /> <span><?php echo wp_html_excerpt( $comment->comment_content, 35 … Read more

get_comment_author_link not working properly

Simple solution drop this in your functions.php function your_get_comment_author_link () { global $comment; if ($comment->user_id == ‘0’) { if (!empty ($comment->comment_author_url)) { $url = $comment->comment_author_url; } else { $url=”#”; } } else { $url = get_author_posts_url($comment->user_id); } echo “<a href=\”” . $url . “\”>” .get_comment_author () . “</a>”; } If the user is registered this … Read more

Problem code and show comments

This question is very hard to understand but I think that you might need to put wp_reset_query() or wp_reset_postdata() after your Loop (after endwhile;) to to reset the loop and/or the $post variable.

Limit action in comment according to IP

That hook won’t do it. It is a filter. You can alter the IP data but unless you are willing to kill (die; or exit; or wp_die()) the whole script you aren’t going to be able to stop the comment posting. I tested by hooking return false; to the filter. Nothing. You can kill comment … Read more

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 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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)