Last active
December 25, 2015 23:59
-
-
Save ForestMars/7060710 to your computer and use it in GitHub Desktop.
Theme suggestion for node type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function newtheme_preprocess_page(&$vars, $hook) { | |
| if (isset($vars['node'])) { | |
| // If the node type is "blog" the template suggestion will be "page--blog.tpl.php". | |
| $vars['theme_hook_suggestions'][] = 'page__'. str_replace('_', '--', $vars['node']->type); | |
| } | |
| } | |
| // Add a single suggestion for nodes that have the "Promoted to front page" box checked. | |
| function newtheme_preprocess_node(&$variables) { | |
| if ($variables['promote']) { | |
| // looks for node--promoted.tpl.php in your theme directory | |
| $variables['theme_hook_suggestion'] = 'node__promoted'; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment