8

I want to use theme_debug to check which elements of a site use which .tpl files.

I have tried turning it on by using the drush command:

drush @mysite vset theme_debug 1

Though I do get the response theme_debug was set to 1, this does not seem to work.

Would anyone know if there is a way to get this working?

(Drush it's self seems to be working ok as I can use drush @mysite cc all)

3 Answers 3

20

Drush commands to control theme debugging:

Drupal 7

  • To turn it on: drush variable-set theme_debug 1
  • To turn it off: drush variable-set theme_debug 0

Drupal 8+

  • To turn it on: drush state-set theme.debug 1
  • To turn it off: drush state-set theme.debug 0

Then clear your site cache and refresh the page in the browser.

10

You process is right but this another option you can check.

In your Drupal 7 installation simply add this line to your settings.php:

$conf['theme_debug'] = TRUE;

Clear your caches and refresh the page and you should see debug information in your mark-up which contains template suggestions.

Also go for Theme developer module.

2
  • Using drush to turn debugging on/off will not require you to edit the settings.php file or install any additional modules. It's easy to inadvertently cause other issues when editing settings.php, not to mention GIT permission issues if you aren't ignoring that file. Also, adding a module to the site will cause performance issues, even if the module is disabled.
    – agilman
    Sep 13, 2019 at 15:40
  • If theme_debug is explicitly disabled in settings.php, trying to enable it with drush will not work. Mar 18, 2021 at 22:26
-2

Step 1: Path :\sites\default\setting.php

Step 2: Edit Setting.php: remove # from

#$conf['theme_debug'] = TRUE;

Step 3: Save setting.php file

Step 4: Inspect your website then you seen that theme information is show.

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.