2

I Copied the file

bootstrap\theme\system\block.tpl.php

to my subtheme

bootstrap_subtheme\templates\block.tpl.php

I made another 2 copies and renamed them to

bootstrap_subtheme\templates\block--sidebar-first.tpl.php
bootstrap_subtheme\templates\block--sidebar_first.tpl.php

In the subtheme.info file it says regions[sidebar_first] = 'Primary'

The block.tpl override works but the sidebar-first.tpl.php does not get overridden.

What am I doing wrong?

2
  • I have changed the underscore but it doesn't fix my issue.
    – sasdev
    Feb 23, 2014 at 9:43
  • You've cleared the cache as well? Feb 23, 2014 at 9:46

1 Answer 1

3

The name of your template block--sidebar_first.tpl.php is correct. Clear the cache to override the template. OR Put this function in template.php and clear the cache. You will get the suggested template for your block.

On suggested name replace double underscore with double dash for your tpl file, and clear the cache.

function THEMENAME_preprocess_block(&$variables) {
    print_r($variables['theme_hook_suggestions']);     
}
6
  • Using the returned function names. block--blockgroup-sidebar.tpl.php does not work. block--block__52.tpl.php works. Witch is a little odd to me.
    – sasdev
    Feb 23, 2014 at 10:01
  • The block--blockgroup_sidebar.tpl.php doesnt work, even after clearing cache.
    – sasdev
    Feb 23, 2014 at 10:41
  • can you put here all the actual name suggested by above function?
    – Rupesh
    Feb 23, 2014 at 10:43
  • Array ( [0] => block__blockgroup-sidebar [1] => block__block [2] => block__block__52 ) Array ( [0] => block__blockgroup-sidebar [1] => block__system [2] => block__system__main_menu ) Array ( [0] => block__blockgroup-sidebar [1] => block__block [2] => block__block__53 )
    – sasdev
    Feb 23, 2014 at 10:46
  • block--blockgroup-sidebar.tpl.php is correct as you used earlier. May be some other module override this template.
    – Rupesh
    Feb 23, 2014 at 10:51

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.