I have created a custom 404 page using hook_preprocess_page()
:
function THEME_preprocess_page(&$variables) {
$header = drupal_get_http_header('status');
if($header == '404 Not Found') {
$variables['theme_hook_suggestions'][] = 'page__404';
}
}
The contents of page--404.tpl.php
is identical to the contents of page.tpl.php
except that use a static text block instead of calling print render($page['content']);
. When this page is displayed one of the menus disappears from the header. Everything else look just as it does when I'm on a ordinary page except for the menu.
Since I only wan't to change the actual message that is displayed when receiving a 404
page and still use the rest of the markup contained in page.tpl.php
perhaps it would be a better idea to only alter the $page['content']
inside a hook or similar?
Would appreciate if anyone could help me figure out why the menu is vanishing or could give me a solution that only alters the $page['content']
in page.tpl.php
in case of a 404.
function hook_404()
to override the error message which in turn solved the problem. Not really sure why this happend from the beginning though.