admin管理员组文章数量:1334928
I'd like to use some colors from the wordpress admin theme to build my back-end plugin's theme, based on Bootstrap-3 & SASS/LESS.
I think I saw a few functions to get the colors of the admin theme but I am not sure its the right way to go. I am aware there might be 3th party admin themes but I'd be already happy to get the standard-themes covered.
Anyone knows how to do it? thanks. ps: a javascript solution is ok too.
update: I can't rely on Wordpress specific markup since my app is also used outside of WP. All i want is build my plugin's theme (Bootstrap 3-4) using the Wordpress's admin theme's CSS variables (if such exists). So if anyone knows how to build a variables.less/scss file for the Wordpress admin themes, then I am done I guess.
I'd like to use some colors from the wordpress admin theme to build my back-end plugin's theme, based on Bootstrap-3 & SASS/LESS.
I think I saw a few functions to get the colors of the admin theme but I am not sure its the right way to go. I am aware there might be 3th party admin themes but I'd be already happy to get the standard-themes covered.
Anyone knows how to do it? thanks. ps: a javascript solution is ok too.
update: I can't rely on Wordpress specific markup since my app is also used outside of WP. All i want is build my plugin's theme (Bootstrap 3-4) using the Wordpress's admin theme's CSS variables (if such exists). So if anyone knows how to build a variables.less/scss file for the Wordpress admin themes, then I am done I guess.
Share Improve this question edited Dec 17, 2015 at 14:54 xamiro asked Dec 13, 2015 at 12:49 xamiroxamiro 1434 bronze badges3 Answers
Reset to default 3Building admin interfaces in WordPress is quite ad hoc. Which is historical reason for many of those interface looking nothing like WP admin surrounding them.
In general it works in terms of markup, rather than colors. You don't code in terms of "black" or "red", but in semantic terms like "primary" or "notification".
There are are some plugins/guides out there that help figure out markup (for example WP Admin Pattern Library) but they aren't really complete/official/whatever.
So in general the process loosely works as following:
- Find a part of native WP admin with elements you need.
- Ripoff and reuse HTML markup of those elements.
- Fine tune whatever is missing with your own CSS.
- Keep an eye out for changes in markup with new WP releases (it likes to fiddle and keep admin pretty every couple years).
After long digging in 3rd party admin themes and the Wordpress source code (wp-admin/css), the only reliable way to extract something usable like a variables.less/sass file from the latest Worpdress code seems to be in doing it the hard way:
- parse the files from wp-admin/css with an CSS-AST generator (see http://iamdustan/reworkcss_ast_explorer/#/lExnKWzBFZ)
- then transfer the selectors of interest ('.wp-ui-text-icon',....) into the variables.less/sass (in Node.JS).
- As soon you've that file, you're ready to integrate it in your theme
(as soon I got something running, I will post it here; it's quite a painful job but worth the shot).
Many years later, CSS variables are available, and it's pretty easy to extract the currently active admin color scheme to a set of variables that can then be used by a plugin's stylesheet: https://wordpress.stackexchange/a/369713/181870
本文标签: How to incorporate admin theme in my backendplugin
版权声明:本文标题:How to incorporate admin theme in my back-end-plugin 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742315545a2451744.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论