matt
matt

Reputation: 787

wordpress: override html markup for comment_text

I'm trying to customise the comments.php file in a custom theme.

I'm using

<?php comment_text(); ?>

which seems to output the comment text in <p></p> tags. I'm aiming to add the class so that it formats as: <p class='lead'></p> (spot the twitter bootstrap css).

Can anyone help me figure out how to customise these tags... i may want to use other ones <h1>, etc. I've tried apply_filters but I cant get that to work either.

Any ideas?

Upvotes: 0

Views: 441

Answers (1)

mcorkum
mcorkum

Reputation: 448

I'm not sure what you are trying to do. Are you talking about the p tag that wraps the comment, or the p tag that gets added to the comment?

You could try replacing

<?php comment_text(); ?>

With:

<p class='lead'><?php echo $comment->comment_content; ?></p>

You could also you jQuery to add a class. Just make a wrapper with a class of anything, lets say "comment-wrap".

<script type="text/javascript">
$(".comment-wrap p").addClass("lead");
</script>

Upvotes: 2

Related Questions