Skip to content

Instantly share code, notes, and snippets.

@rushfrisby
Created March 20, 2015 03:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rushfrisby/92f5338e89cfc447943f to your computer and use it in GitHub Desktop.
Save rushfrisby/92f5338e89cfc447943f to your computer and use it in GitHub Desktop.
Bootstrap hack for wordpress admin
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