admin管理员组文章数量:1313613
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.
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.
Share Improve this question asked Dec 17, 2020 at 15:59 Jean-Philippe MurrayJean-Philippe Murray 1237 bronze badges1 Answer
Reset to default 0I 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 !
本文标签:
版权声明:本文标题:css - Is there any known plugins that would replace WordPress classes in editor with their Bootstrap 4 equivalent? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741910803a2404433.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论