Skip to content

Tag: comments

How to allow more html tags in the wordpress comments?

Scenario: I am using the tinymcecomments plugin to give some formatting capabilities to commenters. Also oEmbed for Comments is nice one – when you put a link to youtube or vimeo it automatically embeds the video.
With the latest WP update I realised the span tag was removed from comments; colors attributes are filtered by the kses filter.

How to style wordpress default comment form for TwentyTen?

Go to your theme open comments.php if you have one:

and find the line:

comment_form();

Replace it with this code which you could change as you like:

$commenter = wp_get_current_commenter();

$fields =  array(
 'author' => '<p>' . '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /><label for="author">' . __( 'Name' ) . '</label> ' . ( $req ? '<span>*</span>' : '' ) .
 '</p>',
 'email'  => '<p><input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /><label for="email">' . __( 'Email' ) . '</label> ' . ( $req ? '<span>*</span>' : '' ) .
 '</p>',
 'url'    => '<p><input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /><label for="url">' . __( 'Website' ) . '</label>' .
 '</p>',
);

$defaults = array(
 'fields'               => apply_filters( 'comment_form_default_fields', $fields ),
);

comment_form($defaults);

For more information check the wordpress docs: http://codex.wordpress.org/Template_Tags/comment_form