/ Published in: PHP

This will give you the ability to create custom node templates based on the URL alias of a page.
Example: if you create a page with the URL alias "aboutus", you can now use node--page-aboutus.tpl.php as your node template.
Example: if you create a page with the URL alias "aboutus", you can now use node--page-aboutus.tpl.php as your node template.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function template_preprocess_node(&$variables) { $path = drupal_get_path_alias($variables['path']); $variables['theme_hook_suggestions'][] = 'node__page_' . $path; } }
Comments
