I have googled this alot but none of the suggestions I found works for me.

I want to use another html.tpl.php template for a specific page, preferably matched with the url-string to that page, but the id works aswell.

This is the code I'm trying now (in template.php):

function mytheme_preprocess_html(&$variables) {

    $nid = arg(1);

    if ($nid == '1715') {
        $vars['theme_hook_suggestions'][] = 'html__test';
        echo "testing testing";

My custom template file is named: html--test.tpl.php.

The echo part does print on the page so the $nid is correct.

mytheme is not the actual name of my theme, but I replaced it here.

  • 4
    Your parameter is $variables but you're assigning to $vars...
    – Clive
    Sep 2, 2014 at 10:15
  • Be careful when you copy code, make sure the parameters match the code :)
    – Beebee
    Sep 2, 2014 at 10:32

1 Answer 1


Note, there's already template suggestions for html.tpl.php generated by template_preprocess_html (see last lines in the function there)

For a specific node page, you can use html--node--1715.tpl.php where 1715 is the target node id.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.