Share icon

Open the template.php file in your theme for editing.

Look for a function called yourthemename_preprocess_page (replace the yourthemename with your theme’s name).

If this function already exists, you will need to add the if statement to the end of the function just before the closing bracket. Otherwise, you’ll need to create a new function to look like this:

function THEME_preprocess_page(&$variables) {   if (isset($variables['node']->type)) {    // If the content type's machine name is "my_machine_name" the file    // name will be "page--my-machine-name.tpl.php".    $variables['theme_hook_suggestions'][] = 'page__' . $variables['node']->type;    } } 

Now you can create a template file called page--content-type.tpl.php and all nodes with that type will use the new template file.


Add new comment

Restricted HTML