Update post date on every new comment?

From what i understand, you want to change the post’s modification time whenever a comment is left on your post. For this, you need to hook into the wp_insert_comment hook and update the post’s date manually: add_action(‘wp_insert_comment’,’update_post_time’,99,2); function update_post_time($comment_id, $comment_object) { // Get the post’s ID $post_id = $comment_object->comment_post_ID; // Double check for post’s ID, … Read more

count number of user comments with a specific comment meta value

Your basic question is a pure SQL question. $count = $wpdb->get_var( ‘SELECT COUNT( comments.comment_ID ) FROM ‘. $wpdb->comments .’ as comments LEFT JOIN ‘.$wpdb->commentmeta.’ AS cmeta ON comments.comment_ID = cmeta.comment_id WHERE user_id = 1 AND comment_approved = “1” AND comment_type NOT IN (“pingback”, “trackback” ) AND cmeta.meta_key = “rating” AND cmeta.meta_value = 5′ ); I … Read more

Add comments meta fields to comments metabox on post edit screen

Unfortunately the hooks: manage_{$this->screen->id}_columns manage_{$this->screen->id}_sortable_columns manage_comments_custom_column are not available for the post-comments list table, constructed within the wp_ajax_get-comments call. That table consists only of two columns: author and comment. The data for author, avatar, email, url and IP is displayed in the first column. We can on the other hand use a hack like: add_filter( … Read more

disable comments if array exists

Assuming you’re properly using comment_form() to output the comment reply form: if( ! array_key_exists( ‘comments’, $wp_query->query_vars ) ) { // Output the comment form comment_form(); } Edit Based on your comments.php code: // If the user isn’t logged in, don’t display comment form if ( is_user_logged_in() ) { global $wp_query; // If the post type … Read more

Remove link preview in discussion dashboard

Since version 4.1.6, Akismet has a filter which allows you to disable these “mShots” (the site preview popups): <?php function disable_akismet_mshots( $value ) { return false; } add_filter( ‘akismet_enable_mshots’, ‘disable_akismet_mshots’ );

Can I seperate comments from post?

Most starter themes now, like Twenty Eleven, come with separate files for each template — for example, single.php and content-single.php represent the Single (Post) template in Twenty Eleven. The starter theme I use, Reddle (ddl), has the same template hierarchy, and here’s the solution I am using… Create a blank Page (NOT Post) titled “Comments, … Read more

Add Comment Custom Field

Here you go: Adding Custom Fields to WordPress Comment Forms? And another awesome post on this: http://wpengineer.com/2214/adding-input-fields-to-the-comment-form/ Functions are available to add/update, delete comment meta, similar to post and user meta. Edit: Here’s an example to give you a start (put the code into the functions.php or in a custom plugin): Add the fields to … Read more

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