开发者

How can I work with paragraphs in Wordpress?

开发者 https://www.devze.com 2022-12-26 03:58 出处:网络
Wordpress has a filter that automatically add paragraphs to posts. I can remove this by adding the followin code:

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

精彩评论

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