Forums

Comments display as one big paragraph::WHY? (19 posts)

  1. carl_in_florida
    Member
    Posted 6 years ago #

    No matter what you do the comments on my blog display as one big paragraph.

    How do i change that?

    http://revivalblog.com
    WP 2.02

  2. Otto
    Tech Ninja
    Posted 6 years ago #

    I looked at your comments, and they don't appear to actually have any formatting, they're just plain text. Needless to say, that's very odd. It's like your comments aren't going through the auto-formatting thingy. Do you have the default-filters.php file in the wp-includes directory?

  3. carl_in_florida
    Member
    Posted 6 years ago #

    otto - I have never heard of that file but I checked and it is there.

    When I look at the comments in the backend the formatting is there. But when it goes to post all formatting is completely stripped.

    I have no idea why.

    Any help is much appreciated.

  4. LiverpoolLad
    Member
    Posted 6 years ago #

    I see paragraphs using FireFox, not one big paragraph, just normal ones.

  5. doodlebee
    Member
    Posted 6 years ago #

    That's weird - I am also using Firefox, and I see one big block of text with no line breaks. When I "view source", I see there are no or
    tags on each new line - which causes the run-on.

    Can you post your comments.php code? Maybe there's something there that accidentally got deleted or something.

  6. carl_in_florida
    Member
    Posted 6 years ago #

    WOOHOO! somebody is going to help me (gets all misty)
    Liverpoollad - make sure you are looking at the comments, not the posts. There is definately nothing there.
    \
    <?php

    // Some default filters
    add_filter('bloginfo','wp_specialchars');
    add_filter('category_description', 'wptexturize');
    add_filter('list_cats', 'wptexturize');
    add_filter('comment_author', 'wptexturize');
    add_filter('comment_text', 'wptexturize');
    add_filter('single_post_title', 'wptexturize');
    add_filter('the_title', 'wptexturize');
    add_filter('the_content', 'wptexturize');
    add_filter('the_excerpt', 'wptexturize');
    add_filter('bloginfo', 'wptexturize');

    // Comments, trackbacks, pingbacks
    add_filter('pre_comment_author_name', 'strip_tags');
    add_filter('pre_comment_author_name', 'trim');
    add_filter('pre_comment_author_name', 'wp_specialchars', 30);

    add_filter('pre_comment_author_email', 'trim');
    add_filter('pre_comment_author_email', 'sanitize_email');

    add_filter('pre_comment_author_url', 'strip_tags');
    add_filter('pre_comment_author_url', 'trim');
    add_filter('pre_comment_author_url', 'clean_url');

    add_filter('pre_comment_content', 'stripslashes', 1);
    add_filter('pre_comment_content', 'wp_rel_nofollow', 15);
    add_filter('pre_comment_content', 'balanceTags', 30);
    add_filter('pre_comment_content', 'addslashes', 50);

    add_filter('pre_comment_author_name', 'wp_filter_kses');
    add_filter('pre_comment_author_email', 'wp_filter_kses');
    add_filter('pre_comment_author_url', 'wp_filter_kses');

    // Default filters for these functions
    add_filter('comment_author', 'wptexturize');
    add_filter('comment_author', 'convert_chars');
    add_filter('comment_author', 'wp_specialchars');

    add_filter('comment_email', 'antispambot');

    add_filter('comment_url', 'clean_url');

    add_filter('comment_text', 'convert_chars');
    add_filter('comment_text', 'make_clickable');
    add_filter('comment_text', 'wpautop', 30);
    add_filter('comment_text', 'convert_smilies', 20);

    add_filter('comment_excerpt', 'convert_chars');

    // Places to balance tags on input
    add_filter('content_save_pre', 'balanceTags', 50);
    add_filter('excerpt_save_pre', 'balanceTags', 50);
    add_filter('comment_save_pre', 'balanceTags', 50);

    // Misc. title, content, and excerpt filters
    add_filter('the_title', 'convert_chars');
    add_filter('the_title', 'trim');

    add_filter('the_content', 'convert_smilies');
    add_filter('the_content', 'convert_chars');
    add_filter('the_content', 'wpautop');

    add_filter('the_excerpt', 'convert_smilies');
    add_filter('the_excerpt', 'convert_chars');
    add_filter('the_excerpt', 'wpautop');
    add_filter('get_the_excerpt', 'wp_trim_excerpt');

    add_filter('sanitize_title', 'sanitize_title_with_dashes');

    // RSS filters
    add_filter('the_title_rss', 'strip_tags');
    add_filter('the_title_rss', 'ent2ncr', 8);
    add_filter('the_content_rss', 'ent2ncr', 8);
    add_filter('the_excerpt_rss', 'convert_chars');
    add_filter('the_excerpt_rss', 'ent2ncr', 8);
    add_filter('comment_author_rss', 'ent2ncr', 8);
    add_filter('comment_text_rss', 'htmlspecialchars');
    add_filter('comment_text_rss', 'ent2ncr', 8);
    add_filter('bloginfo_rss', 'ent2ncr', 8);
    add_filter('the_author', 'ent2ncr', 8);

    // Actions
    add_action('publish_post', 'generic_ping');
    add_action('wp_head', 'rsd_link');

    ?>
    \

  7. doodlebee
    Member
    Posted 6 years ago #

    That's your comments.php file? Is it the whole thing? Wow. That's a lot of filters!

    However, I don't see any actual *formatting* - only filters. You've got to at least have this line in your comments.php file:

    <?php comment_text() ?>

    That's where the formatting is.

    I understand the need for filters - but cripes - why so many? And where'd your formatting go?

  8. carl_in_florida
    Member
    Posted 6 years ago #

    I don't know is this make a difference but if I completely strip the above file bare and use the default theme it still does not format the comments.

  9. carl_in_florida
    Member
    Posted 6 years ago #

    sorry, that is default-filters.php

  10. carl_in_florida
    Member
    Posted 6 years ago #

    here is my comments.php but it does not matter what theme I use, it is all the same. And i think the plugins did the filters. I have never touched it.
    \
    <!-- comments ................................. -->
    <div id="comments">

    <?php // Do not delete these lines
    if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    die ('Please do not load this page directly. Thanks!');

    if (!empty($post->post_password)) { // if there's a password
    if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
    ?>
    <p class="nocomments"><?php _e("This post is password protected. Enter the password to view comments."); ?>
    <?php
    return;
    }
    }
    $commentalt = '';
    $commentcount = 1;
    ?>

    <?php if ($comments) : ?>

    <h2><?php comments_number('No Comments yet', '1 Comment', '% Comments' ); if($post->comment_status == "open") { ?> Add your own<?php } ?></h2>

      <?php foreach ($comments as $comment) : ?>

      <li id="comment-<?php echo $commentcount ?>" class="<?php comment_type('comment','trackback','pingback'); ?>">
      <p class="header<?php echo $commentalt; ?>"><?php echo $commentcount ?>.

      <?php if (function_exists("gravatar")) { ?><img src="<?php gravatar("R", 23); ?>" alt="" class="gravatar" /><?php } ?>

      <?php if ($comment->comment_type == "comment") comment_author_link();
      else {
      strlen($comment->comment_author)?$author=substr($comment->comment_author,0,25)."&hellip":$author=substr($comment->comment_author,0,25);
      echo 'comment_author_url.'">'.$author.'';

      }
      ?>  |  <?php comment_date('F jS, Y') ?> at <?php comment_time() ?>

    <?php if ($comment->comment_approved == '0') : ?>Your comment is awaiting moderation.<?php endif; ?>
    <?php comment_text() ?>
    <?php edit_comment_link('Edit Comment','<span class="editlink">','</span>'); ?>

    <?php
    ($commentalt == " alt")?$commentalt="":$commentalt=" alt";
    $commentcount++;
    ?>

    <?php endforeach; /* end for each comment */ ?>

    <?php endif; ?>

    <?php if ($post->comment_status == "open") : ?>

    <h2>Leave a Comment</h2>

    <?php if (get_option('comment_registration') && !$user_ID) : ?>
    You must be /wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in to post a comment.

    <?php else : ?>

    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    <fieldset>

    <?php if ($user_ID) : ?>

    <p class="info">Logged in as /wp-admin/profile.php"><?php echo $user_identity; ?>. /wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>">Logout.

    <?php else : ?>

    <label for="author">Name</label> <input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" tabindex="1" /> <?php if ($req) echo "Required"; ?>
    <label for="email">Email</label> <input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" tabindex="2" /> <?php if ($req) echo "Required, "; ?>hidden
    <label for="url">Url</label> <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" tabindex="3" />

    <?php endif; ?>

    <label for="comment">Comment</label> <textarea name="comment" id="comment" cols="45" rows="10" tabindex="4"></textarea>
    <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
    <input type="submit" name="submit" value="Submit" class="button" tabindex="5" />

    </fieldset>
    <?php do_action('comment_form', $post->ID); ?>
    </form>

    Some HTML allowed:<br/><?php echo allowed_tags(); ?>

    <?php endif; // If registration required and not logged in ?>

    <?php endif; // if you delete this the sky will fall on your head ?>

    <?php if ($post-> comment_status == "open" && $post->ping_status == "open") { ?>
    ">Trackback this post  |  <?php comments_rss_link('Subscribe to the comments via RSS Feed'); ?>
    <?php } elseif ($post-> comment_status == "open") {?>
    <?php comments_rss_link('Subscribe to the comments via RSS Feed'); ?>
    <?php } elseif ($post->ping_status == "open") {?>
    ">Trackback this post
    <?php } ?>

    </div> <!-- /comments -->
    \

  11. Otto
    Tech Ninja
    Posted 6 years ago #

    Hmm. It appears that the conversion from text to html is supposed to happen in the comment_text call, but isn't for some reason. Weird.

    Is the functions-formatting.php file there and does it look okay? Don't post the whole thing please, just answer the question. Look for "function wpautop" and see if there's anything unusual there. Yes, it has a lot of weird character stuff in it, but the important thing to find out here is if it's there at all.

  12. carl_in_florida
    Member
    Posted 6 years ago #

    Thanks for your help.

    I found the culprit.
    The ESV plugin http://www.musterion.net/?page_id=196. when I disable it, all is fine. Now to find a fix ...

  13. doodlebee
    Member
    Posted 6 years ago #

    >>sorry, that is default-filters.php<<

    LOL! I was wondering!

    Hmm...that's really odd.

    Try this. Find this line in your filters list:

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

    and change it to this:

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

    see what happens? Maybe that will work? (this is such a weird problem!)

  14. doodlebee
    Member
    Posted 6 years ago #

    oops...posted after you did - glad you figured it out!

  15. Otto
    Tech Ninja
    Posted 6 years ago #

    OH! I see the problem. It's in the ESV plugin all right.

    Towards the bottom of esv.php, on line 614, in the function esv_display(), there is a line that says "echo $content;".

    That should be "return $content;" instead. Echoing the content at that point, before the remaining filters have applied, causes the bad display. If it returned it instead, then other filters would be able to take effect. Mainly, the wpautop filter would be able to run and convert it to html properly.

    Alternatively, you can change this line at the bottom:
    add_filter('comment_text', 'esv_display', 20);
    to this:
    add_filter('comment_text', 'esv_display', 40);

    That will change the priorities and make wpautop run before this filter does.

    Actually, you probably want to do both of these changes. That way, the esv_display filter will be operating on html instead of text.

  16. carl_in_florida
    Member
    Posted 6 years ago #

    otto - is this your plugin?

    I was just going to wait till they updated the plugin but since you went through this much effort I have to give this a try.

  17. carl_in_florida
    Member
    Posted 6 years ago #

    OK here is the feedback -

    Towards the bottom of esv.php, on line 614, in the function esv_display(), there is a line that says "echo $content;".

    That should be "return $content;" instead.

    This fixed the formatting but disabled the java popup with the scripture.

    If i do this

    \add_filter('comment_text', 'esv_display', 20);
    to this:
    add_filter('comment_text', 'esv_display', 40);\

    and leave the original echo $content; all is well.

    Thanks for the help!

  18. Otto
    Tech Ninja
    Posted 6 years ago #

    carl: No, it's not my plugin. I just downloaded it and skimmed the code.

    And ideally, you should do both the 20->40 change and the echo->return change. By using an echo there instead of a return, it unintentionally disables all filters that occur after it in the filter chain. The 20->40 puts it after the wpautop filter in the chain, which would have horked up the formatting of the script code.

    So do both changes, that's my recommendation. You won't notice any difference with the echo->return change if you also do the 20->40, but it will prevent possible breakage with other plugins.

  19. Chris Roberts
    Member
    Posted 6 years ago #

    Great info. I'm the ESV plugin creator and these comments will be most helpful. :) Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.