How can I work with paragraphs in Wordpress?
Question
Wordpress has a filter that automatically add paragraphs to posts. I can remove this by adding the followin code:
// Remove the <p> tags which WP automatically inserts in psots.
remove_filter ('the_content', 'wpautop');
The problem is that i removes <br />
tags as well.
So I'm not removing this filter at the moment. My problem is that inside a DIV box, I get extra space above and below the text (at the start / end of text).
I could manipulate the <p>
tag in css, but again, that will affect all <p>
tags throughout the post content.
Any suggestions to what I should do?
Solution
i believe this would help you
<?php wpautop( $post, $br = 0 ); ?>
the second parameter is boolean and is to do with the line breaks.
OTHER TIPS
Try removing blank lines after and before in your post content.
I don't think @mroggle's method might work.
The last I had this issue, I had to manually throw in <br />
s.