0

I want to add a static block to the header and footer to add custom CSS ( head area ) and JS to footer area.

I'm doing this so if i want to add custom CSS I don't have to edit files and upload them via FTP. I can just edit the static block and it's there instantly

My CSS static block is called inline-css and JS one is inline-js

Any help would be great. Thanks.

1 Answer 1

1

If you don't have already one, create a file called local.xml in your theme (app/design/frontend/<your-theme>/default/layout/local.xml) with the following content :

<?xml version="1.0" encoding="UTF-8"?>
<layout>
    <default>
        <reference name="head">
             <block type="cms/block" name="inline_css" as="inline_css">
                <action method="setBlockId"><block_id>inline-css</block_id</action>
             </block>
        </reference>
        <reference name="footer">
             <block type="cms/block" name="inline_js" as="inline_js">
                <action method="setBlockId"><block_id>inline-js</block_id</action>
             </block>
        </reference>
    </default>
</layout>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.