IPB
Your Ad Here


Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Strip paragraph tags that surround an image (or apply a class)
Misha Singh
post Nov 6 2009, 02:16 PM
Post #1


Advanced Member
***

Group: Members
Posts: 7,885
Joined: 23-November 08
Member No.: 6,521



Wordpress annoyingly puts all images within paragraph tags.

Does anyone know of a function that would basically either remove the paragraph tags for the image or apply a class to the opening tag.

Obviously preg_replace is the ideal candidate but the regex is way beyond my current understanding of it.


Code:
<p><img class="alignright size-full wp-image-4" title="Letters" src="/uploads/2009/11/temp-skh-image.jpg" alt="Letters" width="490" height="594" /></p>
to


Code:
<img class="alignright size-full wp-image-4" title="Letters" src="/uploads/2009/11/temp-skh-image.jpg" alt="Letters" width="490" height="594" />

Thanks in advance.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
Tags
No Tag inserted yet

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 21st November 2009 - 02:55 PM
Your Ad Here