Created
March 20, 2015 03:28
-
-
Save rushfrisby/92f5338e89cfc447943f to your computer and use it in GitHub Desktop.
Bootstrap hack for wordpress admin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bootstrapCss = 'bootstrapCss'; | |
if (!document.getElementById(bootstrapCss)) | |
{ | |
var head = document.getElementsByTagName('head')[0]; | |
var bootstrapWrapper = document.createElement('link'); | |
bootstrapWrapper.id = bootstrapCss; | |
bootstrapWrapper.rel = 'stylesheet/less'; | |
bootstrapWrapper.type = 'text/css'; | |
bootstrapWrapper.href = '../wp-content/plugins/myplugin/css/bootstrap-wrapper.less'; | |
bootstrapWrapper.media = 'all'; | |
head.appendChild(bootstrapWrapper); | |
var lessjs = document.createElement('script'); | |
lessjs.type = 'text/javascript'; | |
lessjs.src = '../wp-content/plugins/myplugin/scripts/less.min.js'; | |
head.appendChild(lessjs); | |
//load other stylesheets that override bootstrap styles here, using the same technique from above | |
var customStyles = document.createElement('link'); | |
customStyles.id = "customStyles"; | |
customStyles.rel = 'stylesheet'; | |
customStyles.type = 'text/css'; | |
customStyles.href = '../wp-content/plugins/myplugin/css/styles.css'; | |
customStyles.media = 'all'; | |
head.appendChild(customStyles); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment