image link to hive image link to ko-fi


Drupal 7 notes: node or page template by path

Because I always seem to manage to completely forget how to do something this basic. template.php in theme_preprocess_page(&$variables) or theme_preprocess_node(&$variables) <?php $path = drupal_get_path_alias(); if (strpos($path, 'part_of_url') !== false) { $variables['theme_hook_suggestion'] = 'page__whatever'; // or node__whatever if using in a node preprocess } ?> This work is marked with CC0 1.0 Universal