I would like to remove the H2 tag from search and some other blocks (not from all of them by block.tpl.php). I use sub theme of Zen. Hope somebody can help me.
How to remove H2 tag from some blocks
2.8k views Asked by user2144918 AtThere are 4 answers
Clive has already answered the question which is, IMO, correct - but as you are saying you are not very experienced with PHP, let me suggest something that does not involve coding - but keep in mind: Learning Drupal and PHP is easy and a fun if you have plenty of time to read docs and testing.
From "remove h2", I'm assuming you mean to remove the h2 tag with class title
.
In the block's configuration page, enter <none>
as the title of the block - your block will not contain the title (and its h2
tag).
This is a per-block setting.
It's a vague question so the answer will be equally vague...
function MYTHEME_preprocess_block(&$vars) {
if ($vars['block']->info == 'foo') {
$vars['theme_hook_suggestions'][] = 'block__no_title';
}
}
Then add a block--no-title.tpl.php file to your theme, copy the markup from block.tpl.php, and remove the <h2>
. Clear Drupal's theme registry cache and you're done.
Go to blocks configuration page -> edit block -> enter
<none>
as a title.This is the CMS way and this is how you should do it.