Title: When adding a external CSSJS, changes wordpress layout
Last modified: August 20, 2016

---

# When adding a external CSSJS, changes wordpress layout

 *  [kingofkings360](https://wordpress.org/support/users/kingofkings360/)
 * (@kingofkings360)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/when-adding-a-external-cssjs-changes-wordpress-layout/)
 * Hello,
 * I want to add an external header on the wordpress page, but when I add an external
   CSSjs file in header.php for example:
    $head->addCss(‘css/styles.css’); $head-
   >addJs(‘prototype/prototype.js’);
 * The external header displays correctly but this changes the whole layout of the
   page. Everything on the page is centered.
 * How can I limit the effect of $head variable, so that is doesn’t affect wordpress.
 * Thanks

Viewing 11 replies - 1 through 11 (of 11 total)

 *  [Big Bagel](https://wordpress.org/support/users/big-bagel/)
 * (@big-bagel)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/when-adding-a-external-cssjs-changes-wordpress-layout/#post-2335656)
 * CSS and JavaScript will apply to whatever elements it’s set to apply to. For 
   example, if this is in your external CSS file, it will apply to every div with
   the class banana:
 *     ```
       div.banana {
       /* whatever rules you want */
       }
       ```
   
 *     ```
       $head->addCss('css/styles.css');
       $head->addJs('prototype/prototype.js');
       ```
   
 * There’s no `$head` variable in WordPress by default. Does `$head` contain a custom
   class you made?
 *  Thread Starter [kingofkings360](https://wordpress.org/support/users/kingofkings360/)
 * (@kingofkings360)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/when-adding-a-external-cssjs-changes-wordpress-layout/#post-2335734)
 * This is the header code unchanged:
 * _[code moderated - please use the [http://pastebin.com/](http://pastebin.com/)
   and follow the [forum guidelines for posting code](http://codex.wordpress.org/Forum_Welcome#Posting_Code)]_
 * The header works fine, but all the content of wordpress page is centered?
 *  Thread Starter [kingofkings360](https://wordpress.org/support/users/kingofkings360/)
 * (@kingofkings360)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/when-adding-a-external-cssjs-changes-wordpress-layout/#post-2335832)
 * Here is the pastebin
 * [http://pastebin.com/iZwAzCR4](http://pastebin.com/iZwAzCR4)
 *  [Big Bagel](https://wordpress.org/support/users/big-bagel/)
 * (@big-bagel)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/when-adding-a-external-cssjs-changes-wordpress-layout/#post-2335842)
 * From the code, I’m assuming you’re using the [Mage Enabler plugin](http://wordpress.org/extend/plugins/mage-enabler/).
   This is really an issue with that plugin. I have no idea what the plugin does,
   but did you check it’s installation and faq pages?
 * [http://wordpress.org/extend/plugins/mage-enabler/installation/](http://wordpress.org/extend/plugins/mage-enabler/installation/)
   
   [http://wordpress.org/extend/plugins/mage-enabler/faq/](http://wordpress.org/extend/plugins/mage-enabler/faq/)
 * It might help to have a link to your site to see what’s happening.
 *  Thread Starter [kingofkings360](https://wordpress.org/support/users/kingofkings360/)
 * (@kingofkings360)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/when-adding-a-external-cssjs-changes-wordpress-layout/#post-2335880)
 * No I’m not using the enabler plugin.
 * Although I have used its, code. The CSSjs causes the problem. As it’s loaded,
   it affects the whole page.
 *  [Big Bagel](https://wordpress.org/support/users/big-bagel/)
 * (@big-bagel)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/when-adding-a-external-cssjs-changes-wordpress-layout/#post-2335883)
 * I know, but this isn’t a problem with WordPress. You’re using a class that is
   added through that plugin’s code. The CSS and the JavaScript added are also specific
   to that plugin. Without knowing how you installed it, what it does (a link the
   where you downloaded it would be helpful in this case), or a link to your site
   to see what it’s doing, it’s nearly impossible to help you. Since it is a problem
   with the plugin, you can also try asking the author, since he/she will know much
   more about it.
 *  Thread Starter [kingofkings360](https://wordpress.org/support/users/kingofkings360/)
 * (@kingofkings360)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/when-adding-a-external-cssjs-changes-wordpress-layout/#post-2335897)
 * I used the code from this page:
 * [http://mysillypointofview.richardferaro.com/2010/07/03/how-to-add-magento-blocks-css-and-javascript-to-an-external-site/](http://mysillypointofview.richardferaro.com/2010/07/03/how-to-add-magento-blocks-css-and-javascript-to-an-external-site/)
 *  [Big Bagel](https://wordpress.org/support/users/big-bagel/)
 * (@big-bagel)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/when-adding-a-external-cssjs-changes-wordpress-layout/#post-2335899)
 * It’s most likely just a CSS issue. Without a link to the site I can’t say anything
   more specific.
 *  Thread Starter [kingofkings360](https://wordpress.org/support/users/kingofkings360/)
 * (@kingofkings360)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/when-adding-a-external-cssjs-changes-wordpress-layout/#post-2335900)
 * I’m on localhost
 *  Thread Starter [kingofkings360](https://wordpress.org/support/users/kingofkings360/)
 * (@kingofkings360)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/when-adding-a-external-cssjs-changes-wordpress-layout/#post-2335901)
 * Can i pu the Cssjs in a loop so that is works only till the magento header? and
   after that it is not loaded>
 *  [Big Bagel](https://wordpress.org/support/users/big-bagel/)
 * (@big-bagel)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/when-adding-a-external-cssjs-changes-wordpress-layout/#post-2335904)
 * There is no CSSjs, it’s a CSS file and a JavaScript file. Once added, they apply
   to the whole page. If the new CSS file is affecting other parts of your page,
   there are probably rules within it that are accidentally matching existing elements(
   tags, ids, classes) of your page. Without seeing the site or both the generated
   code for your existing site and the added CSS, that’s the only help anyone can
   offer.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘When adding a external CSSJS, changes wordpress layout’ is closed to 
new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 11 replies
 * 2 participants
 * Last reply from: [Big Bagel](https://wordpress.org/support/users/big-bagel/)
 * Last activity: [14 years, 7 months ago](https://wordpress.org/support/topic/when-adding-a-external-cssjs-changes-wordpress-layout/#post-2335904)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
