Changing the comments link produced by the get_comments_link() and get_comments_pagenum_link() functions

So the solution to the get_comments_pagenum_link() function is straightforward enough: add_filter(‘get_comments_pagenum_link’ , ‘new_get_comments_pagenum_link’); function new_get_comments_pagenum_link($content) { $content = str_ireplace(‘#comments’ , ‘#other’, $content); return $content; } Which filters the output of get_comments_pagenum_link() to replace #content with #other, or any other string you might choose. For the get_comments_link() function, which can’t be filtered, I have simply discovered … Read more

Is comment metadata included in the export file?

My latest export from my blog (WP 3.3.1) now has the commentmeta in the XML. It’s in this format: <wp:comment> <wp:comment_id>…</wp:comment_id> … <wp:comment_user_id>0</wp:comment_user_id> **<wp:commentmeta> <wp:meta_key>name_of_meta</wp:meta_key> <wp:meta_value><![CDATA[value_of_meta]]></wp:meta_value> </wp:commentmeta>** </wp:comment> I was looking for information on it while trying to write an exporter from another system. Not much information available online so I tried an export from … Read more

Separete trackbacks/pings and numbered comments

For numbering, in your comment.php, change this: wp_list_comments(‘callback=mytheme_comment’); To this: wp_list_comments(array( ‘callback’=>’mytheme_comment’, ‘style’=>’ol’, )); For separation into comments and pingbacks, you’d do something like this: wp_list_comments(array( ‘callback’=>’mytheme_comment’, ‘style’=>’ol’, ‘type’=>’comment’, )); wp_list_comments(array( ‘callback’=>’mytheme_comment’, ‘style’=>’ol’, ‘type’=>’pings’, ));

Follow-up Comments Notification Without a Plug-in

It’s quite simple, just hook a function on comment_post in which you check if the comment is a reply and send the author of the parent comment an email: add_action(‘comment_post’, ‘notify_author_of_reply’, 10, 2); function notify_author_of_reply($comment_id, $approved){ if($approved){ $comment = get_comment($comment_id); if($comment->comment_parent){ $parent_comment = get_comment($comment->comment_parent); wp_mail($parent_comment->comment_author_email, ‘Hello’, ‘Dude you got a reply…’); } } } For … Read more

Filter custom comment type from Manage Comments & Dash Widgets

Doh, looks like the answer was staring me in the face. add_filter( ‘comments_clauses’, ‘myPlugin_exclude_custom_comments’, 10, 1); function myPlugin_exclude_custom_comments( $clauses ) { // Hide all those comments which aren’t of type system_message $clauses[‘where’] .= ‘ AND comment_type != “system_message”‘; return $clauses; } What this does is edit all comment queries to find comments that don’t have … Read more

Comments deactivated

Comments might have been closed once. If you change this option later globally it doesn’t affect existing posts when comments were turned off per post. To test if comments really work create a new post and enable the discussion meta box on that screen: If you can comment while all plugins are disabled and the … Read more

Ajax comments not working

<div> <div class=”CommentList”></div> <form action=”” class=”commentForm”> <textarea name=”comment”></textarea> <input type=”button” value=”Comment” class=”btnComment” /> </form> </div> <div> <div class=”CommentList”></div> <form action=”” class=”commentForm”> <textarea name=”comment”></textarea> <input type=”button” value=”Comment” class=”btnComment” /> </form> </div> <script type=”text/javascript”> $(document).ready(function () { $(‘.commentForm’).each(function () { $(this).prepend(‘<div class=”comment-status”></div>’); }); $(‘.commentForm’).find(‘.btnComment:button:not(.Process)’).live(‘click’, function () { $(this).addClass(‘Process’).attr(‘disabled’, true); var commentFormObj = $(this).parents(‘form.commentForm’); commentFormObj.find(‘textarea[name=comment]’).val(”); var statusDivObj = … Read more

Loading post comments after clicking a button

You could try an easy jQuery approach of hiding the comments div and inserting a button to make it appear. Instructions: In your functions.php file of your theme, place this line of code to ensure that jQuery has been included to run the code: wp_enqueue_script(‘jquery’); Then you could add this function to place the javascript … Read more

Limit user to one comment

<?php global $current_user; $args = array( ‘user_id’ => $current_user->ID, ‘post_id’ = 100, // post ID. Can be ‘$post->ID’ depending where you are calling this from ‘count’ => true ); if(get_comments($args) >= 1){ echo ‘disabled’; } else { comment_form(); } Function_Reference/get_comments Based on AndrettiMilas code.

Changing “submitted on date” of comments

I presume you mean the format of the date that is displayed for the comment. Different themes will do this different ways, but in general there should be a comments.php file which should contain what makes up a comment. In here should be wp_list_comments(); You will need to add a callback in here which will … Read more

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