سؤال

I'm trying to make a simple modification to the Bartik theme. I just want to disable the permalink in the user comments.

  • I copied /themes/bartik/templates/comment.tpl.php to /sites/all/themes
  • and modified /sites/all/themes/comment.tpl.php as follows:

    <p class="comment-permalink">
      <?php // print $permalink; ?>  <!-- comment out permalink -->
    </p>
    
  • I cleared all caches but the permalink still displays.

If I make the modification above to the source file (/themes/bartik/templates/comment.tpl.php), it works... but I read you're not supposed to modify the source file. That's why I moved it to /sites/all/themes.

What am I doing wrong?

هل كانت مفيدة؟

المحلول

I copied /themes/bartik/templates/comment.tpl.php to /sites/all/themes

And modified /sites/all/themes/comment.tpl.php

This will definitely not work. The content of the new file will not be rendered at all, and Drupal will not even care about this file, because you are not using the theme format that Drupal expects.

Modifying the original theme is NOT a good practice, that's correct. If you would like to make slight modifications to the original theme, you have to create a subtheme, which inherits the parent theme's resources.

After enabling the new subtheme, you can copy Bartik's comment.tpl.php to the new subtheme's templates directory, clear cache, and enjoy modifying your own theme's files based on Bartik without worrying about the original ones.

Btw. I suggest you using Drupal Answers: https://drupal.stackexchange.com/.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top