3

On occasion a <figure> tag will make it through WYGWAM with a <p> wrapped around it which breaks my layout (and is incorrect formatting anyway). Can I remove just the <p> tags that appear around specific elements? If so, how?

2

You can use the add-on Find and Replace Plus. http://devot-ee.com/add-ons/find-and-replace-plus

This should work for you.

{exp:replace_plus}
  {replace_area find="<p><figure>" replace="<figure>"}
  {replace_area find="</figure></p>" replace="</figure>"}
    text you want processed
  {/replace_area}
  {/replace_area}
{/exp:replace_plus}
| improve this answer | |
  • So this should work but it's not recognizing the white space between <p> and <figure> tags. In the HTML there is often whitespace and newlines between those tags. Tried this but it didn't work: {replace_area find="<p>:SPACE:<figure" replace="<figure"} – Brandon Durham Jul 26 '13 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.