I am looking for a simple and effective way to implement template for specific block IDs.

From what I read in Author information lost after saving node and Drupal 6 Template Suggestions, I came up with the following code, which doesn't seem to work:

function mytheme_preprocess_block(&$vars) { 
  array_unshift($vars['template_files'], 'block-' . $vars['region'] . '-' .   filter_xss($vars['id'])); 

From the Drupal documentation it should block-module-delta.tpl.php.

  • Delta is the block ID, that's ok
  • Module? What's the module here it's a custom block created by adding a block.

2 Answers 2


Use Firebug to inspect the generated HTML to get the block name|module !

  • Ok, firebug gives a block id of 'block-block-19' so i put a file named 'block-block-19.tpl.php' but didn't work.
    – Disco
    May 4, 2011 at 9:49
  • Oh, I had block theme enabled which caused to bypass my template suggestion. Works fine now ! Thanks !
    – Disco
    May 4, 2011 at 9:53
  • From api.drupal.org/api/drupal/modules--block--block.module/function/… Try: block--block--19.tpl.php
    – user334
    May 4, 2011 at 9:56
  • 1
    just for the record block-block-19.tpl.php AND block--block--19.tpl.php actually works.
    – Disco
    May 4, 2011 at 10:33

Have you checked out the skinr module? http://drupal.org/project/skinr


You can add classes to particular blocks and reuse styles. This can be very helpful if you're using a grid system or any of the grid themes.

Your Answer

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

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