Add placeholder attribute to comment form fields

You should filter ‘comment_form_default_fields’ to add the placeholder attribute. Sample code add_filter( ‘comment_form_default_fields’, ‘wpse_62742_comment_placeholders’ ); /** * Change default fields, add placeholder and change type attributes. * * @param array $fields * @return array */ function wpse_62742_comment_placeholders( $fields ) { $fields[‘author’] = str_replace( ‘<input’, ‘<input placeholder=”‘ /* Replace ‘theme_text_domain’ with your theme’s text domain. * … Read more

Show content only if member left a comment

Check if the user has left a comment // the user may have commented on *any* post define( ‘CHECK_GLOBAL_FOR_COMMENTS’, TRUE ); // // some more code // function memberviparea( $atts, $content = null ) { $post_id = 0; // if the user have to left a comment explicit on this post, get the post ID … Read more

Facebook comments box on front page

Fast ‘n’ Hacky The problem can be solved by changing line 319 in facebook.php to the following: if (is_home()) { This way, the front page is not treated as a home page but as a regular page, for which the facebook feature settings can be applied (and will be handled correctly). More Elegant/Complex Here is … Read more

get comments and get posts in loop

get_comments accepts an array of arguments, you are passing an integer. If you want to retrieve all comments for a post use: get_comments( array(‘post_id’ => $post->ID, ‘status’ => ‘approve’) ); To get an already formatted comment list, is easier use the wp_list_comments() function, instead of another foreach cycle (code from codex): echo ‘<ol class=”commentlist”>’; //Gather … Read more

How to remove comment spam in WordPress

Just install a good anti-spam plugin. They will monitors site’s comments for spam and automatically blocks spam comments. BTW WordPress come with Akismet which is a spam protection plugin installed by default. To enable the plugin, go to the Plugins and activate the Plugin. Akismet Anti-Spam

How can I add comments to a page?

Have you checked under Admin -> Settings -> Discussion and for individual pages, under pages and quick-edit or the discussion area in edit page below the page editor? When the last one does not show, click screen options near the top right, and tick discussion there, then scroll back down.

Get comments for more than one post

The ‘post_id’ is converted to a positive integer in WP_Comment_Query, so you cannot successful pass anything else to get_comments(). You have to filter ‘comments_clauses’. Here you can change the WHERE clause to use comment_post_ID IN ( $ids ) instead of comment_post_ID = $id. I would use a static class as a wrapper for get_comments(). Sample … Read more

Reverse comment pagination numbers

i’ve used wp_list_comments like this: <?php if (class_exists(‘Walker_Comment_Wink’)) $walker = new Walker_Comment_Wink(); else $walker=””; wp_list_comments(array(‘walker’ => $walker, ‘type’ => ‘comment’ , ‘callback’ => ‘theme_comment2’)); ?> i used the plugin http://winkpress.com/articles/fix-reversed-comments-pagination/ to fix the “* and 1 comment” weirdness. You have the option to pass $reverse_top_level (boolean) (optional) Setting this to true will display the most … Read more

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