• Does comment_text() add a set of <p></p> tags around comments?

    Is there anyway I can remove the <p> tags if they are being automatically inserted into my page with the comment?

    (They are messing up my style)

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter rickdan

    (@rickdan)

    Does anyone have any suggestions? I just want to find out how to stop a set of <p> tags being put around my comments.

    What file is responsible for the comments?

    comments.php is responsible for all of the comments. I need to add a class to <p> in the “comment_text” Does anyone know how to do this?

    Just do this:

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

    Only problem with that solution is if you’re using the class “comment-text” to add a box around the text for instance, the <p></p> tags that are automatically wrapped around that text adds a big space to the bottom of that box.

    ----------
    | Text... |
    | (space) |
    ----------

    I’d also like to know if there’s some way to disable the tags without having to mess around with the php files.

    I’ve just figured out a solution for that – as I also needed the comments without the <p> tags wrapped around them.

    Remove the following line from your comments.php file in the folder wp-content/themes/YOUR_THEME_FOLDER

    <?php comment_text() ?>

    Now place it with:

    <?php echo $comment->comment_content; ?>

    And that’s it!

    Wow, the EXACT answer I was looking for! Thank you!

    Very helpful! Thanks!!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Does comment_text() add a set of <p></p> tags around comments?’ is closed to new replies.