1

How do I add custom CSS or JS to for a particular page?

Suppose,i want add a custom css file for Checkout cart which will only show n at Cart.

Example: like a FAQ or any single page

3

if you want to add a css file to all cms pages add this to your local.xml

<layout>
    <cms_page_view>
        <reference name="head">
            <action method="addItem">
               <type>skin_css</type>
               <name>path/to/file.css</name>
            </action>
       </reference>
    </cms_page_view>
</layout>

If you want a css file just for the FAQ page, go to that CMS page and go to Design tab in the left menu and insert:

<reference name="head">
  <action method="addItem">
    <type>skin_css</type><name>path/to/file.css</name>
  </action>
</reference>
1

You should add some CSS/JS files only in local.xml file in your magento theme.

app/design/frontend/PACKAGE/TEMPLATE/layout/local.xml

<layout>
    <default>
        <reference name="head">
            <action method="addJs">
                <script>path/to/file.js</script>
            </action>

            <action method="addItem">
               <type>skin_css</type>
               <name>path/to/file.css</name>
            </action>
       </reference>
    </default>
</layout>

https://blog.liip.ch/archive/2013/10/24/adding-javascript-and-css-files-to-head-section-of-magento.html

0

You can find the related phtml pages, here in your file directory

/app/design/frontend/default/YOURTHEME/template/page

depending on your theme, you might see files named

1column.phtml
2columns-left.phtml
2columns-right.phtml
3columns.phtml

You can find the header section in those files, where you can link your CSS files or js

1
  • Editing the .phtml files is not the correct way of adding a stylesheet.
    – Agop
    Jun 24 '15 at 0:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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