Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By leeuwnhawk on
I have a use case wherein I need to switch to the Bartik theme when the user requests for the '/about' page on my website. This is what I have tried so far:
Approach one:
function mymodulename_custom_theme()
{
if (arg(0) == 'about')
{
return 'bartik';
}
}
Approach two:
$items['about'] = array(
'page callback' => 'foo_bar',
'theme callback' => 'porto_theme_callback',
);
function porto_theme_callback() {
return 'bartik';
}
However, neither of the above two approaches seem to be working. I have enabled the bartik theme, and have tried clearing caches as well. Any help would be highly appreciated!
Comments
Assuming the /about page is a
Assuming the /about page is a node, you want:
This worked just fine. Thanks
This worked just fine. Thanks!
Or ....
https://www.drupal.org/project/themekey