Tag Info

Hot answers tagged

7

Create a file in wp-content/plugins/ with this code: <?php /* Plugin Name: Get Rid of Comment Websites */ function my_custom_comment_fields( $fields ){ if(isset($fields['url'])) unset($fields['url']); return $fields; } add_filter( 'comment_form_default_fields', 'my_custom_comment_fields' ); Normally, I'd say put it into your theme's ...


7

Hi @Emerson: Do you want before the list of comments or before the comment form (I assume the latter?) If yes, and I'm assuming you are either using the TwentyTen theme or a theme that uses the new comment_form() function from WordPress 3.0.0? If so it's as simple as using the 'comment_form_before' hook. Here's an example you can place in your theme's ...


6

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); ...


5

There are a couple other hooks in the comment form that you can use. Where you're hooking on only displays if the user isn't logged in. If you want that field for all users (logged in or not), you need to add your form by hooking into both comment_form_after_fields and comment_form_logged_in_after, both of which are actions, and echo out the new field. ...


4

You could just take a look at the Codex Page for wp_list_comments which has some example code for customising comment listings. You will see from that page that you can add a callback function to wp_list_comments which is normally used to customise how comments are listed


4

You are probably looking for Jetpack comments system. If so, you can install Jetpack plugin and then activate the Comments module, if it is not activated by default upon plugin activation. After plugin installation, you may also need to connect to your WordPress.com account to enable any (or all) Jetpack features as indicated in the installation ...


3

To save your extra field, you have to do : function save_comment_meta_data( $comment_id ) { add_comment_meta( $comment_id, 'extra_field', $_POST[ 'extra_field' ] ); } add_action( 'comment_post', 'save_comment_meta_data' ); See this nice tutorial covering extra fields in comment forms.


3

wp_list_comments() uses Walker_Comment class (that extends generic Walker) to generate output. If you need extensive customization you should extend Walker_Comment with your own class and pass instance of it as walker argument to the function.


3

I can think of only following ways to achieve this. There is a filter "comments_open" that check if the post whose $post_id is provided has comments open. You can use that to return false. There is another filter "comments_template" that return the template file to be used to display comment form. You can return an empty file and hence no comment form will ...


3

Don't link the script file directly. Enqueue it instead, e.g. in functions.php: function mytheme_enqueue_comment_reply() { // on single blog post pages with comments open and threaded comments if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { // enqueue the javascript that performs in-link comment ...


3

Quite old post, but while searching I came here, maybe someone else will find it useful. The only solution I found is to completely rebuilt the button that comment_reply_link returns. I first made two vars reconstructing href and onclick attributes for the reply button: $reply_href = wp_make_link_relative( get_permalink( $comment->comment_post_ID ) ...


3

If you check out the source of the function comment_form(), you'll see it doesn't even print a class on the input; <input name="submit" type="submit" id="<?php echo esc_attr( $args['id_submit'] ); ?>" value="<?php echo esc_attr( $args['label_submit'] ); ?>" /> I'm guessing you need to add a class for styling? Why not modify your CSS to ...


3

This code makes no sense: function my_fields($fields) { $fields['new'] = '<p>red rover 1</p>'; return $fields; } add_filter('comment_form_top','my_fields'); I'm not even sure what it's supposed to do, because comment_form_top is an action, not a filter. If you want to add extra fields, you should be using the comment_form_default_fields ...


3

you might find these links handy if you're going to code it yourself http://byronyasgur.wordpress.com/2011/06/27/frontend-forward-facing-ajax-in-wordpress/ http://www.garyc40.com/2010/03/5-tips-for-using-ajax-in-wordpress/ I am fairly sure your URL is wrong url: "../wp-comments-post.php" - ajax in wordpress has to be sent (quite strangely) to/through ...


3

For people that come here looking for a more detailed explanation about the text domain issue instead of just "use a text domain". Here's how it works. Firstly, you have to tell WordPress where the language files should be put in your theme, and what the 'theme slug' is (a unique identifier for your theme) like so: add_action('after_setup_theme', ...


3

That's pretty simple. You just have to take the textarea out of the default fields – filter 'comment_form_defaults' – and print it on the action 'comment_form_top': <?php # -*- coding: utf-8 -*- /** * Plugin Name: T5 Comment Textarea On Top * Description: Makes the textarea the first field of the comment form. * Version: 2012.04.30 * Author: ...


2

You may use my plugin Magic Widgets. It creates a sidebar (widget) area on four actions. Plus, you get a text widget that outputs exactly the markup you put therein. There is a second plugin for the comment form. After activation you can place a widget on any place there. Screenshot You don’t have to change the theme’s code, and you can even switch ...


2

Do you mean modifying its text or behavior? The function is very extensive and customizable. It both accepts extensive set of parameters and has a lot of hooks. For starters see: comment_form() in Codex; WordPress 3.0 Theme Tip: The Comment Form.


2

add_filter( 'cancel_comment_reply_link', '__return_false' ); See /wp-includes/comment-template.php#function get_cancel_comment_reply_link() for more background. But if you do that the reply form will not move to the comment. The more interesting question is: Why doesn’t the link work for you? Do you have this line in your footer? is_singular() and ...


2

The easiest and most straight-forward way is to put appropriate code in your wp_list_comments() callback, that outputs a message if a comment is awaiting moderation. The usual code looks something like this: <?php if ($comment->comment_approved == '0') : ?> <em><?php _e('Your comment is awaiting moderation.') ?> Otherwise, if you're ...


2

In your comments.php template file use wp_list_comments and set the parameter callback to your defined function that will generate the template. Inside the function you can style the comment reply link. wp_list_comments codex Further reading on comment display


2

I know this is quite an old post and maybe this could help someone. You can replace the class of an element using add_filter(); Here's an example: // filter to replace class on reply link // class name function name add_filter('comment_reply_link', 'replace_reply_link_class'); function replace_reply_link_class($class){ $class ...


2

I'm working with the Foundation framework as well. I've found that the easiest way to add a class to a non-filterable element is to do it with jQuery. jQuery(document).ready(function($) { //noconflict wrapper $('input#submit').addClass('button'); });//end noconflict


2

Why do you need a class on the submit button? You can give it an ID, as you have discovered, and that's all you need for styling it. comment_form(array('id_submit'=>'buttonPro')); Then to style it: input#buttonPro {...} Simple. Or, if you prefer to use classes only for some reason: .form-submit input {...} There's no advantage I can see, from any ...


2

Comment is Easily Customaziable. for example: code for cancel the reply link <?php cancel_comment_reply_link(); ?> if you want custom the Text like Reply means Replace Text... <?php cancel_comment_reply_link(text); ?> Text to display as a link. If empty, it will return the default: 'Click here to cancel reply.'it should be work.


2

I liked toscho answer. However I wanted to use a custom textarea, so it didn't work in that case. I used the same hooks but with separate functions: add_filter( 'comment_form_defaults', 'remove_textarea' ); add_action( 'comment_form_top', 'add_textarea' ); function remove_textarea($defaults) { $defaults['comment_field'] = ''; return $defaults; } ...


2

This works fine for me: <?php add_filter('comment_form_default_fields', 'wpse53687_filter_fields'); /** * Unsets the email field from the comment form. */ function wpse53687_filter_fields($fields) { if(isset($fields['email'])) unset($fields['email']); return $fields; } One reason that it could be failing on your theme is that args ...


2

You have to set the value of $_POST['comment_post_ID'] to the post id of the page: <input type='hidden' name='comment_post_ID' value='10' /> Then set the action of the form element to /wp-comments-post.php, filter 'comment_post_redirect' and send the visitor back to page where the comment/review was written. Here is an example, written as plugin: ...


2

Edit your comments.php template and add in <ol class="commentlist"> <?php wp_list_comments(); ?> </ol> This should display comments, pingbacks and trackbacks. See the Codex for wp_list_comments() for help on how to style and separate or to display just comments.


2

You have commenting turned off for logged-out users. To change this setting, visit the Settings > Discussion page in your WordPress admin and uncheck the Users must be registered and logged in to comment box. Remember to update the setting by clicking the Save Changes button.



Only top voted, non community-wiki answers of a minimum length are eligible