Sticky Comments

I was curious about any existing plugins and searched the plugin directory. There exists an old Sticky Comments plugin, I’m not related to it. It seems to use a sticky meta key. It uses a LEFT JOIN query but creates it’s own version of the whole comments_template() core function, to override the current query. One … Read more

comment_reply_link() not showing up

You should try to replace <?php comment_reply_link(); ?> with: <?php comment_reply_link( $args ); ?> and to make sure the $args[‘depth’] is not zero or greater or equal than the $args[‘max depth’]. There will be no output if that’s not the case. If that doesn’t work, you could try to add the comment ID or the … Read more

Does WordPress Allow Blank/Empty Comment Submissions In WordPress?

Short answer: It doesn’t, but you can get around this: add_filter(‘comment_form_field_comment’, ‘my_comment_form_field_comment’); function my_comment_form_field_comment($default){ return false; } add_action(‘pre_comment_on_post’, ‘my_pre_comment_on_post’); function my_pre_comment_on_post($post_id){ $some_random_value = rand(0, 384534); $_POST[‘comment’] = “Default comment. Some random value to avoid duplicate comment warning: {$some_random_value}”; } If you want this only for certain pages, then you should create a custom page template, … Read more

List Recent Comments from Across a Multi-site Network

Ok, I did some research based on בניית אתרים‘s solution here, as I’m interested in this too. First you need to get a list of blog IDs, and get_blog_list() is deprecated because it seems to be a “suicidal database query” 🙂 Anyway looks like there will be a alternative in WP 3.2 called wp_get_sites(). So … Read more

Facebook Comment Count

Final version of code used: function fb_comment_count($link = ‘link’) { global $post; $url=”https://graph.facebook.com/”; $posturl = get_permalink($post->ID); $url .= $posturl; $filecontent = wp_remote_retrieve_body(wp_remote_get($url, array(‘sslverify’=>false))); $json = json_decode($filecontent); $count = $json->comments; if ($count == 0 || !isset($count)) { $count = 0; } $comments = $count; if ($count == 1) { $comments .= ‘ Comment’; } elseif ($count … Read more

Comments Reply Form

Ensure that you have Threaded Comments enabled: go to Dashboard -> Settings -> Discussion and enable the option to thread comments Ensure that your Theme enqueues the comment-reply script. Look for the following, usually in header.php, functions.php, etc.: <?php wp_enqueue_script( ‘comment-reply’ ); ?> Note: this call is usually wrapped in a conditional, such as: <?php … Read more

Why is styling comments so complex?

If you prefer simple template files, you can do that with custom comment callbacks too. Call wp_list_comments() with a custom callback handler: wp_list_comments( array( ‘callback’ => ‘custom_comment_callback’, ‘style’ => ‘ol’ ) ); Now make that callback function very simple: function custom_comment_callback( $comment, $args, $depth ) { include ‘comment-template.php’; } And now you can use comment-template.php … Read more

Display all comments or recent comments per user on author page

your problem is using author_email, you need user_id: i just use similar script. <?php $args = array( ‘user_id’ => get_the_author_meta(‘ID’), ‘number’ => 10, // how many comments to retrieve ‘status’ => ‘approve’ ); $comments = get_comments( $args ); if ( $comments ) { $output.= “<ul>\n”; foreach ( $comments as $c ) { $output.= ‘<li>’; $output.= … Read more

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