2

I'm using MX-Jumper to replace EE style code in a WYGWAM field with images. The WYGWAM content will look something like this:

{image_1}

Climb leg rub face on everything give attitude nap all day for under the bed. Chase mice attack feet but rub face on everything hopped up on goofballs.

Using MX-Jumper I'm replacing {image_1} with images from a Matrix field. Thing is when putting {image_1} in the WYGWAM field it’s getting wrapped in a <p></p> tag.

Is there any way to strip or even disallow a <p></p> tag around these shortcodes?

1

That likely comes down to how you are placing the shortcode into the Wygwam field - the

tags are likely wrapped around {image_1} before any replacement is done. Have you tried this:

{image_1}Climb leg rub face on everything give attitude nap all day for under the bed. Chase mice attack feet but rub face on everything hopped up on goofballs.

That may still not be exactly what you are looking for though, since it would place the image within the

tgs of the paragraph. But you should still be able to use your CSS to compensate though, applying your desired styling to the combination of p tag followed by img tag - particularly if you surround the wygwam field with something to allow you to target is specifically. Then you wouldn't necessarily need to remove it in the code, just remove its impact visually.

| improve this answer | |
  • The shortcode can't be inside of a paragraph because I'm replacing it with a <figure> tag. – Brandon Durham Jul 25 '13 at 18:57
  • You can also create your own CKEDITOR template to output a chunk of HTML in a wygwam field. <div>{short_code}</div> – Bransin Oct 30 '15 at 14:01

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.