Hello,

I was wondering how I can update how the comments in Drupal 7 are displayed, in a way that is not lost when I update core. A Google search had previously pointed me towards updating comment.tpl.php in /modules which worked for my needs (specifically I wanted to move the submitted by from above the comment to underneath the comment, so I just moved the div in comment.tpl). However, when I update core, it says to delete everything outside of /sites, which of course means /modules gets deleted and I have to redo my template changes every time I update core. Is there any way I can update core and avoid this annoyance?

Comments

VM’s picture

copy core tpl.php files to your theme.
Edit the tpl.php files as you wish
clear database cache of edited tpl.php isn't overriding the default

Spokenbird’s picture

Thanks for the reply!

Do you mean to just copy comments.tpl.php from /modules and move it into my theme folder within /sites? If I am using a subtheme, would I put it in the subtheme folder?

Does this get negated when I update the Theme?

RWill’s picture

Edited tpl.php will go into your sub-theme if it's the default theme. Your changes won't be lost if you are using a sub-theme since updates are not applied to a sub-theme.

Spokenbird’s picture

Thanks!

RWill’s picture

Hello,

You can use theme hook to 'format comments of a certain node type'. comment--node-type.tpl.php file will reside at [document root]/sites/all/themes/[custom_theme]/templates

More here