tags:

views:

135

answers:

2

Hey all,

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</h1>
    <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>
A: 

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.

Jeff
A: 

Wordpress uses a plugin called wpautop. This script automatically adds

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.

Sid Vel