开发者

How can I work with paragraphs in Wordpress?

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?


i believe this would help you

<?php wpautop( $post, $br = 0 ); ?>

the second parameter is boolean and is to do with the line breaks.

codex link


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜