Context: I'm using WordPress as a backend for article writing on a non-wordpress site (built with Laravel, using Corcel to access the data, if that matters). That website is built with Bootstrap 4, and when fetching the posts written in WordPress, there's a couple of classes that is added by WordPress for styling that, of course, does not translate to Bootstrap.

For example, when centering an image in a post, WordPress adds an aligncenter css class that, if rendered in a Bootstrap (4) context, does nothing. To acheive the centering of the image, I would have to manually add the mx-auto d-block classes to each and every images of the post... In every post. But I'd like this to be done automatically.

I did try to install some themes in WP that where specifically designed for Bootstrap 4, thinking it might force the editor to use the wanted classes, but it doesn't.

This question/answer provides a couple of example on how it could be acheived but before reinventing the wheel, I'd like to know if there is any know plugin that would do this? Or even some stylesheet that I could add to the non wordpress site that would understand WP classes in a bootstrap context maybe ?

A quick search in WordPress' plugin page and Google returns nothing in that regard, but I fear that I'm just lacking of the right search terms for a successfull search.

1 Answer 1


I will provide an answer, because it works, but I'll be waiting for an answer that more straightfully answer my question (about a pluging, specifically).

What I realized after posting this question is that the starter theme that uses Bootstrap I installed thinking it would force the editor to use Bootstrap classes do display the post correctly, in a Bootstrap context (basically rendering, in the example in the question, aligncenter correctly). So I went on and took its CSS, stripped unwanted classes (CSS resets for example), and applied this sheet to my article pages only.

It works !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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