Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After following the instructions to create a sub theme and followed method 1 to include Bootstrap (downloaded v3.3.1), the theme seems to be working fine, but I cannot seem to override default template files.
Copying page.tpl.php
in the /templates
directory and modifying it does not change anything. It looks like the original template file is used instead. Clearing the cache, disabling / enabling the theme does not change this.
Environment: php 5.3.28 / Drupal 7.28 / Bootstrap 3.3.1 / JQuery 1.9
Comments
Comment #1
quimicComment #2
quimicAfter redoing it all again (creating another sub theme), template files are properly loaded.
Comment #3
PascalAnimateur CreditAttribution: PascalAnimateur commentedI'm having a similar issue with a field template file not being loaded by my sub-theme (freshly created from the cdn starterkit). I'm using the latest bootstrap -dev (7.x-3.1-beta1+23-dev)
My field is called field_sirul so I tried adding field--field-sirul.tpl.php in my_subtheme/templates (formerly /theme .. but it didn't work then either). I also tried placing it in my_subtheme/ directly, nothing works. I did clear the cache everytime..
Do I have to manually specify my template overrides in a my_subtheme_theme hook ? Where is this documented?
Comment #4
C.T. Studd CreditAttribution: C.T. Studd commentedI'm having the same problem!
Comment #5
PascalAnimateur CreditAttribution: PascalAnimateur commented@C.T. Studd, my problem turned out to be caused by the semantic_fields module.
Can you provide more details on the templates you're trying to override?
Comment #6
gurtner CreditAttribution: gurtner as a volunteer commentedI'm having a similar issue and my initial search took me to this page... For me, the issue seems to be that once cache is cleared, navigating to a different page somehow reverts back an old, cached page with bootstrap as the default theme, instead of using my bootstrap sub-theme tpl files that override the parent theme. Anyone had this issue before? I'll post my fix once I figure it out :-)
Comment #7
gurtner CreditAttribution: gurtner as a volunteer commentedComment #8
stephenls CreditAttribution: stephenls commentedPosting this for the benefit of others who land here, scratching their heads. Do make sure that your template suggestion uses underscores, not dashes:
$variables['theme_hook_suggestions'][] = "page__" . $variables['node']->type;
$variables['theme_hook_suggestions'][] = "page--" . $variables['node']->type;
Not using underscores will completely break things, with theme debug mode being none the wiser.