I would like to know how to hide header and footer for specific category ID. For example, I have 5 categories: categories are cat1, cat2, cat3, cat4, cat5. I want to hide header and footer in every pages if the category id is equal to cat1. Is it possible to do so?


Simon has a good answer but you can also do this through the admin control panel in Magento using a custom layout update setting on the category editor:

  • Log in to your admin console and visit Catalog > Manage Categories.
  • Select the category you want to change in the left column.
  • Click the "Custom Design" tab in the middle column.
  • Set "Use Parent Category Settings" to "No"
  • inside the "Custom Layout Update" box add the following:

<remove name="header" />

<remove name="footer" />

  • Save the category's changes and go check your website.

This will affect the selected category and all it's child categories by default. If you later want to change another category, you can repeat these steps on that category. You can also re-edit this category and reverse these steps to change the design of that category back again.


I tested this on 1.7 and I have just assumed that the same functionality exists in whichever version you are using.

| improve this answer | |
  • Hi, Dear Russ Wilde, According to your guidance, I am able to hide header and footer for specific category. But what I want is that for category id 1, there will be products under category id 1. If I click the products which are under category id 1, I would like to hide header and footer for product detail page. In product detail page, I will click Buy Now button. After Buy Now button is clicked, product add to card page will be shown. I would like to hide header and footer of product add to card page also. Is it possible to do so? – Po Po Naing Aug 18 '14 at 14:31
  • This is another problem and you should post another question for it. – Simon Aug 18 '14 at 15:11
  • Yes it is possible but the solution will be much more complicated than this technique. Categories are not the right way to separate out products to do this. I would suggest that you create two store views with different designs to do it, rather than just relying on categories, then have one store view that has no header or footer in it's design for the required pages, and offer those products through that store. Like Simon says, however, this is a different problem and would need a complicated answer. – Russ Wilde Aug 18 '14 at 15:38
  • Thank you so much! I am going to raise the question "How to create two store views with different designs" Please kindly help me for the problem I am going to raise. Thanks a lot! – Po Po Naing Aug 18 '14 at 15:50
  • @ Good works... – Amit Bera Aug 18 '14 at 16:46

In addition to Simon's answer.
You can create a custom layout handle so you won't duplicate the code for every category.
Something like this:

    <remove name="header" />
    <remove name="footer" />

Then just use this handle in all the other category handles

    <update handle="category_remove_header_footer" />
    <update handle="category_remove_header_footer" />
    <update handle="category_remove_header_footer" />

Replace 1, 2..5 with the real category ids.
This could be useful if you later want to change something for all these categories. You can do it in one place for all of them.

An other cleaner approach would be to add a new attribute to the category entity called 'Hide header and footer' ( code hide_header_footer). It should be a 'Yes/No' attribute.
Then create the layout handle category_remove_header_footer as mentioned above and rewrite the method Mage_Catalog_CategoryController::viewAction and below

$update->addHandle('CATEGORY_' . $category->getId());

add this:

if ($category->getHideHeaderFooter()) {

This involves more code, but it seams cleaner and portable. You may later want other categories with no header or footer. With this approach you can set that from the backend, without coding anything else.

| improve this answer | |

There are specific layout handles for each category with a specific ID. Mind that the ID is solely numeric. If the ID is 1, then you can do something like this in your local.xml:

    <remove name="header"/>
    <remove name="footer"/>
| improve this answer | |
  • Hello Simon, as I am the beginner, I do not know where to put the above code. local.xml is the one located under app\etc\local.xml? If it is, could you please guide me to put your code under which tag in local.xml? Thanks a lot. – Po Po Naing Aug 18 '14 at 8:06
  • 1
    Sorry, but a little bit of research is also required on your site. en.lmgtfy.com/?q=magento+local+xml – Simon Aug 18 '14 at 8:09
  • Hello Simon, when I put the code that you provided above, it hides the header and footer including home page and other category pages also. It hides every pages. I only want to hide the pages that are related to specified category id. Is it possible to do so? Thank you so much! – Po Po Naing Aug 18 '14 at 15:04
  • Then you probably use it in a wrong way :/ You have to put it directly inside the <layout> tag. – Simon Aug 18 '14 at 15:11
  • It only hides for specified category page. But does not hide for product details page, product add to cart page and check out page as well. Is there a way to hide those? Thank you so much! – Po Po Naing Aug 18 '14 at 15:35

create on an event on catalog page render and remove the footer and header by observer



and observer code is

public function myremove($observer)
               if (in_array($catId, $specialCategoriesId)) {
               $blockName = 'footer'; // Add yours
                $update = Mage::app()->getLayout()->getUpdate();
                $removeInstruction = "<remove name=\"$blockName\"/>";

        }catch(Excpetion $e){


| improve this answer | |
  • Hello, Dear Amit Bera, your code only effects to my home page. It does not effect to the specified category id. Do I need to update something in myremove function? Thank you so much. – Po Po Naing Aug 18 '14 at 8:37
  • Naing .i have put a static id Mage::registry('current_category')->getId()=2,Mage::registry('current_category')->getId() give current category id you need to put there you logic – Amit Bera Aug 18 '14 at 9:26

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.