0

I'm using the Zen sub-theme. I don't want all the new stuff on the site showing on the home page so I'm editing page--front.tpl.php. Removed print render($page['content']). But now I want to add some static text and and image to my home page.

How do I go about doing this basic thing?

  • 1
    I think the real issue here is you're seeing new pages automatically posted to the front page, correct? There's a simple solution to stop this behavior: go to admin/config/system/site-information (Drupal 7) and set a default front page (node/X). Other options are the front page module, panels, blocks, etc. In other words, there's really no reason to alter page--front.tpl.php as that's the last place the next developer will check. – Webdrips Mar 15 '15 at 9:27
  • @Webdrips you got it right, thank you! Your points are noted. – Sage Mar 15 '15 at 10:09
1

You can simply create a node, and put this node (eg. node/15) in the admin/config/system/site-information default frontpage field.

Otherwise you can also create a custom page with hook_menu() like this:

$items[path] = array(
    'title callback' => 'page title',
    'page callback' => 'page_callback',
    'access callback' => 'access_callback',
    'type' => MENU_SUGGESTED_ITEM,
);

and in page_callback() you can return your custom theme template/function.

Or simply use some contributed modules like "Empty Page", "Front Page", "Empty Front Page" and others..

  • thanks! one question of clarification: does hook_menu() always have to be in custom module or is it ok to call it from template.php? – Sage Mar 16 '15 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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