WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. rickdan
    Member
    Posted 6 years ago #

    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!

  2. rickdan
    Member
    Posted 6 years ago #

    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?

  3. greg9885
    Member
    Posted 6 years ago #

    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?

  4. Justin Tadlock
    Member
    Posted 6 years ago #

    Just do this:

    <div class="comment-text">
    	<?php comment_text(); ?>
    </div>
  5. Ozukaki
    Member
    Posted 5 years ago #

    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.

  6. gallaghersean
    Member
    Posted 5 years ago #

    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!

  7. Loughlin
    Member
    Posted 5 years ago #

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

  8. Ingenius Dastard
    Member
    Posted 5 years ago #

    Very helpful! Thanks!!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.