Strip paragraph tags that surround an image (or apply a class) |
![]() ![]() |
Strip paragraph tags that surround an image (or apply a class) |
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. |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 21st November 2009 - 02:55 PM |