The question:
How can i remove category title (H1) from a specific page of catalog?
I deleted breadcrumbs using a code xml:
<remove name="breadcrumbs"/>
Is it possible to replicate this with H1? Thanks!
The Solutions:
Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.
Method 1
Unfortunately you cannot do that via xml layouts only.
But you have a few other options. All of them require some coding.
Option 1 – Quick and dirty
Edit app/design/frontned/{package}/{theme}/catalog/product/category/view.phtml
and add an if statement
around the h1
tag. Something like this:
if ($_category->getId() != 44) { //your category id here
//h1 tag here
}
Option 2 – with attributes.
Add a new yes/no attribute to the category called hide_title
.
Then you need to edit the same template as in option 1 and add this if
statement
if (!$_category->getHideTitle()) {
//h1 tag here
}
I would use this approach. This way you can always hide the title from the backend for every category you need.
Option 3 – no attributes but a new theme.
Create a new theme inside your package.
Let’s call it no_title
.
This theme should contain only one file. The category view template:
app/design/frontned/{package}/no_title/catalog/product/category/view.phtml
.
This has to be a clone of your normal view file from your theme with just the h1
tag removed.
Then, for the categories you don’t want the title you set them to use this new theme from the design settings tab in the backend.
Method 2
Option 4 – You can add this under the “custom design” tab in a category. Just copy the original view.phtml. Edit the title section to either remove it or comment out.
The path to this file is: /your_theme/template/catalog/category/
<reference name="category.products">
<action method="setTemplate">
<template>catalog/category/your-view.phtml</template>
</action>
</reference>
Cheers ~ Happy Coding!
Method 3
This cannot be done in a pure XML method. However it can be done via the admin for a specific category.
Admin -> Catalog -> Manage Categories -> select the category to edit -> click Custom Design tab -> inside Custom Layout Update add this code:
<reference name="before_body_end">
<block type="core/text" name="hide.heading">
<action method="setText">
<text>
<![CDATA[
<style type="text/css">
.category-title { display: none; }
</style>
]]>
</text>
</action>
</block>
</reference>
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0