Hi all,
I'd like to use the Bartik theme with some modifications for my Drupal 7 site. I thought the best way to do this is to create a child theme of Bartik, but this is proving to be quite difficult for me (and I couldn't find any help on this after scouring the web and forums for a few hours). I created a "BartikChild" theme by:
- Creating sites/all/themes/BartikChild
- Creating a file within that folder called BartikChild.info that looks like this:
name = BartikChild description = A child theme of Bartik. package = Core version = VERSION core = 7.x base theme = Bartik
After I enable the theme, I see the following error on my home page (or any page for that matter):
Notice: Trying to get property of non-object in drupal_alter() (line 981 of /Applications/MAMP/htdocs/drupal-7.0/includes/module.inc).
[This message repeats several times]
Notice: Undefined index: Bartik in drupal_theme_initialize() (line 99 of /Applications/MAMP/htdocs/drupal-7.0/includes/theme.inc).
Notice: Trying to get property of non-object in phptemplate_init() (line 13 of /Applications/MAMP/htdocs/drupal-7.0/themes/engines/phptemplate/phptemplate.engine).
Notice: Trying to get property of non-object in drupal_alter() (line 981 of /Applications/MAMP/htdocs/drupal-7.0/includes/module.inc).
Notice: Trying to get property of non-object in drupal_alter() (line 981 of /Applications/MAMP/htdocs/drupal-7.0/includes/module.inc).
[This message repeats quite a few more times]
Notice: Trying to get property of non-object in _theme_build_registry() (line 523 of /Applications/MAMP/htdocs/drupal-7.0/includes/theme.inc).
Notice: Trying to get property of non-object in _theme_build_registry() (line 525 of /Applications/MAMP/htdocs/drupal-7.0/includes/theme.inc).
Notice: Trying to get property of non-object in _theme_build_registry() (line 527 of /Applications/MAMP/htdocs/drupal-7.0/includes/theme.inc).
Notice: Trying to get property of non-object in _theme_build_registry() (line 527 of /Applications/MAMP/htdocs/drupal-7.0/includes/theme.inc).
Notice: Trying to get property of non-object in drupal_alter() (line 981 of /Applications/MAMP/htdocs/drupal-7.0/includes/module.inc).
[This message repeats about 20 more times]
I tried clearing my theme registry cache through Drush in hopes that would help, but nothing changed. I ideally want to have a child theme of Bartik since Bartik will be well-maintained, but because this wasn't working, I even tried copying the entire Bartik folder to my sites/all/ and renaming the theme to "BartikCopiedUnmodified" (i.e., I changed the name in the .info file, renamed bartik.info to bartikCopiedUnmodified.info, and changed the folder name to sites/all/BartikCopiedUnmodified). After enabling this theme, this seemed to work initially. However, when I refreshed the site, I saw this error message:
Notice: Undefined variable: hide_site_name in include() (line 99 of /Applications/MAMP/htdocs/drupal-7.0/sites/all/themes/bartikCopiedUnmodified/templates/page.tpl.php).
Notice: Undefined variable: hide_site_name in include() (line 109 of /Applications/MAMP/htdocs/drupal-7.0/sites/all/themes/bartikCopiedUnmodified/templates/page.tpl.php).
Notice: Undefined variable: hide_site_slogan in include() (line 116 of /Applications/MAMP/htdocs/drupal-7.0/sites/all/themes/bartikCopiedUnmodified/templates/page.tpl.php).
This didn't go away even after I cleared the theme registry cache. Any insight as to what I can do to make my child theme work? Is there a better way to do this?
Thanks in advance.
Comments
Info file adjustments
I am not an info file expert but here are a couple of changes you should make:
If you download a copy of the Zen theme, it comes with a folder called STARTERKIT to use as a starting point for making a child theme of Zen. Even though it's Zen-specific, it's helpful as a reference for making sub-themes of other themes. For instance, you can see how they've written a child theme info file and use that as a model to create your own.
I hope this solves your problem!
Tips Worked
Thanks a lot! Making those changes seems to have solved the problem.
Confirming - package
Just confirming that worked for me too -- FTR, deleting the package line was the incremental change that appeared to do it. [EDIT: but then the problem came back -- so i'd better troubleshoot more carefully.]
Hi, I've run into the same
Hi,
I've run into the same exact issue trying to create a Bartik sub-theme (same error description).
I've deleted 'version,' 'package' and changed 'Bartik' to lower-case. I'm still seeing the same issue. Any ideas?
Clear the cache
@walzo - Did you clear your cache? Whenever you change the .info file you have the clear the cache for the changes to take effect. If you've already done that, I'm stumped.
Fixed my issue, too. Thx BrightBold!
Thanks much, BrightBold... I had core listed and also referred to the base theme without all lowercase. Solved
I'm still having the problem
I'm still having the problem after a cache reset. My subtheme.info is:
I've tried with Performance > aggregation both de- and enabled... What's next to check?
Is it fine to leave bartik in ROOT/themes/bartik and have my subtheme in /sites/mysite/themes/subtheme ?
I'm an idiot! "base name"
I'm an idiot! "base name" should be "base theme" obviously!!!
General Sub-theme guide
Hi, I created a nice working baritik subtheme just following this guide:
http://drupal.org/node/225125
My info file structure is:
Note that, as suggested, I copied regions rows, since in the guide is written that those will not be inherited...
To have the "colors" module working, I copied "colors.css" from bartick css folder to my new theme css folder, and the entire colors
folder from bartik theme to my subtheme menu. So I can have separated setting for admin and viewers browsing..
If you find better-lighter approach, please let me know!