By nuthman on
Hello,
I am developing a sub-theme for acquia marina. I wanted to add a few more statements to the theme_preprocess_block() function in template.php.
How do I augment the template.php file for my sub-theme only.
I don't want to modify the base theme itself, since this is bad practice. I have tried copying template.php from the base theme folder to my subtheme's folder, but it does not override it.
It generates the following error:
Fatal error: Cannot redeclare acquia_marina_preprocess() (previously declared in E:\xampp\htdocs\tfn\sites\all\themes\acquia_marina\template.php:16) in E:\xampp\htdocs\tfn\sites\all\themes\tfn\template.php on line 20
What is the best practice to accomplish this?
Comments
Perhaps you're using an old
Perhaps you're using an old version of the theme. The current version of acquia marina doesn't have template.php, but it's using fusion theme as super theme.
In any case, the subtheme should have a different name than the super theme, and that name must be reflected on the .info file and the functions on template.php.
For instance, if the acquia_marina subtheme is called sub_acquia_marina then the folder's name should be sub_acquia_marina, the .info file should be sub_acquia_marina.info and the template.php file should have the function sub_acquia_marina_preprocess_block(&$vars)
Cheers
Thanks!
I'll have to see about downloading the latest version.. not sure how I got the old one!
Also, I thought that I had already done exactly what you suggested, but it didn't work. I'll double check my work. Now, quick question, does my template.php completely override the base theme's template, or just add to it?
Your custom template.php will
Your custom template.php will just add to the parent theme's template.php until you override any functions within it. That's the beauty of creating a subtheme. :)
Excellent!
Thanks a lot. I'll give it a try!