How to allow particular CSS classes for particular HTML tags in post editor?

I’d like to allow text wrapping around images.

For this, I’d make a special CSS class.

Is there a way to allow only selected CSS classes for particular HTML tags in the post body? Currently, it strips any classes if I add them manually.

For example, in editor:

<img src="/uploads/default/original/2X/f/fd7886de9a5629779b3cfd0fad83c5a4b8c81633.png" width="180" height="130" class="wrap-left">

Generated HTML:

<img src="//" width="180" height="130">

So, the class wrap-left is removed.

P.S. We desperately need more advanced editor to make our key posts look better and reflect blog articles.

1 Like

The only way I can think of right now is building a plugin to whitelist that CSS class for the “img” tag.

1 Like

Either use the plugin approach recommended by @zogstrip or wrap with a div:

<div data-theme-wrap-text='right'>
... image goes here...

They use css to target the div > img

1 Like