开发者

Wrap stray text in <p> tags

开发者 https://www.devze.com 2022-12-11 04:54 出处:网络
Wordpress issue.. how do I wrap stray text in P tags? Example: Before- <div class = \"content\"> <img src = \"hello.jpg\"/>

Wordpress issue.. how do I wrap stray text in P tags?

Example:

Before-

<div class = "content">
    <img src = "hello.jpg"/>
    <h1>Introduction</h1>
    Hello! this is stray text that I want to wrap with p tags
    Hello! This is another set of stray text
</div>

After-

<div class = "content">
    <img src = "hello.jpg"/>
    <h1>Introduction</h开发者_如何学Go1>
    <p>Hello! this is stray text that I want to wrap with p tags</p>
    <p>Hello! This is another set of stray text</p>
</div>


Wordpress uses a plugin called wpautop. This script automatically adds <p> </p> tags to new lines. In most cases, this is helpful. Sometimes, it can be a pain. In such a case you can use the Disable Autop Plugin.

You can manually control this by changing the core Wordpress scripts. I suggest using a plugin.


Where is the stray text coming from? Is it being entered into the WordPress WYSIWYG editor? If so, it'll automatically wrap the text in P tags if you have empty lines before and after the text.

0

精彩评论

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