Question

I tried using hook_custom_theme to change the theme for the node add page for a specific content type, like this, without success:

function mymodule_custom_theme() {
  if (current_path() == 'node/add/mytype')
    return 'anothertheme';
}

I know the function is running, and I know the comparison is returning TRUE. Why is it not working?

Était-ce utile?

La solution 2

1) Do you use the correct machine name for the theme?

2) Are you sure that there are not other modules to override this later?

3) Is the page cached? If so this may not work properly.

Same question and discussion here: https://drupal.stackexchange.com/questions/812/how-do-i-change-a-theme-based-on-the-url

Useful modules:Page Theme, Context, ThemeKey.

Autres conseils

I think you are not writing the theme name correctly.

But there is a module which could do this work for you: https://drupal.org/project/themekey

Regards.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top