4

I modified the core's Bartik theme file, node.tpl.php. I simply added

echo "Last updated by $name on " . format_date($node->changed);

The problem is that when there is a new core update, my change will be overwritten. Is there a way to create a module that will easily add this simple line in the node.tpl.php of Bartik's node.tpl.php theme file so that future updates will not overwrite my change?

1 Answer 1

7

What you want to do is create a subtheme of Bartik, and make your modifications to node.tpl.php there instead. Themes support the notion of inheritance, so this can be leveraged to tweak core themes without actually hacking core. As a rule, it is best practice not to hack core for the reasons you mentioned and a slew of others, security not the least among them.

1
  • Thanks, this got me 95% of the way there. Unfortunately I am not able to use the color picker preview to change my theme's colors. It only works if I start to copy over the Bartik 'color' and 'css' folders. This means I am essentially just copying file for file Bartik's code, which I don't want to do. I just want to overwrite that one file. Nonetheless, without copying over the 'color' and 'css' folder, my node.tpl.php is overriding Bartik's node.tpl.php, which is good enough for me. I will hand set my colors or do custom CSS.
    – user785179
    Commented Mar 8, 2012 at 21:41

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.