Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

The line breaks on my comments are not being considered. I've inspected the elements in google chrome and it seems that wordpress is not adding paragraph tags <p> to them, while in the body text it does.

The comments.php in my template has the following snippet:

<ol class="commentlist">
    <?php wp_list_comments(); ?>
</ol>

No options of wp_list_comments() seems to be related to this.

Also, in the file default-filter.php I have the line

add_filter( 'comment_text', 'wpautop', 30 );

So I don't understand why it's not adding the tags.

Is anyone facing the same problem?

share|improve this question
1  
Disable all plugins, switch to TwentyEleven. Does it still happen? –  toscho Apr 8 '12 at 22:26
    
@toscho - Thanks for your comment. It was indeed a plugin that was causing this issue. More specifically Crayon Syntax Highlighter 1.9.1 –  kunigami Apr 9 '12 at 23:38
1  
@kunigami sorry about that, other users also reported this and it's fixed in 1.9.3 –  Aram Kocharyan May 2 '12 at 11:33

2 Answers 2

You should structure your comment so it would use the "comment_text" build in function or even easier should use a fallback function that would structure your comment...

For example in twenty ten it looks like this:

function twentyten_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
    case '' :
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
    <div id="comment-<?php comment_ID(); ?>">
    <div class="comment-author vcard">
        <?php echo get_avatar( $comment, 40 ); ?>
        <?php printf( __( '%s <span class="says">says:</span>', 'twentyten' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
    </div><!-- .comment-author .vcard -->
    <?php if ( $comment->comment_approved == '0' ) : ?>
        <em><?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?></em>
        <br />
    <?php endif; ?>

    <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
        <?php
            /* translators: 1: date, 2: time */
            printf( __( '%1$s at %2$s', 'twentyten' ), get_comment_date(),  get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' );
        ?>
    </div><!-- .comment-meta .commentmetadata -->

    <div class="comment-body"><?php comment_text(); ?></div>

    <div class="reply">
        <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    </div><!-- .reply -->
</div><!-- #comment-##  -->

<?php
        break;
    case 'pingback'  :
    case 'trackback' :
?>
<li class="post pingback">
    <p><?php _e( 'Pingback:', 'twentyten' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __('(Edit)', 'twentyten'), ' ' ); ?></p>
<?php
        break;
endswitch;
}
endif;

so... you can include this code or embed it in your functions.php then make
it a callback default like so.. :

wp_list_comments( array( 'callback' => 'twentyten_comment' ) );

.
The difference is this part:

comment_text()

.
You can read here about: comment_text()

.
Hope this helps ;)
Best of luck, Sagive.

share|improve this answer
    
The default wp_list_comments() should already work just fine. There is no need to introduce extra code into the problem. –  toscho Apr 8 '12 at 22:27
    
so... what might be the problem? cuz' i once solved this using this method... would love to know how to short-solve this when this happens. –  Sagive SEO Apr 8 '12 at 23:39
    
Some other code removed the default filter for 'wpautop'. I should have closed the question until the missing information is added. –  toscho Apr 8 '12 at 23:41
    
ok... i guess its a work in progress to get to what information is missing :) - thanks for the info –  Sagive SEO Apr 8 '12 at 23:45
up vote 1 down vote accepted

Thanks to @toscho I've found the problem.

Crayon Syntax Highlighter 1.9.1 seems to have a bug. While it's not fixed, one workaround that is reasonable for me is unchecking the "Allow Crayons inside comments" option.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.