1

I am trying to override the front page node, however after following the guide from the official site, it's not working.

Guide: https://www.drupal.org/node/1585528

I have taken node.tpl.php and renamed it to node--front.tpl.php and made changes to the layout, saved and cleared cache. The changes are not being displayed.

Now if I edit node.tpl.php directly it shows the changes, anyone know what I am doing wrong to override specific node templates?

EDIT: I want to move the title below the image being displayed in the front page.

See below: Moving the title block under the content block, moves the title down as I want it to do, however how do I specify this for just the front page and not all nodes? (renaming node.tpl.php to node--front.tpl.php does not work as mentioned above)

In node.tpl.php: (title block)

<?php print render($title_prefix); ?>
<?php if (!$page): ?>
  <h2<?php print $title_attributes; ?>>
    <a href="<?php print $node_url; ?>"><?php print $title; ?></a>
  </h2>
<?php endif; ?>
<?php print render($title_suffix); ?>

(content block)

<div class="content clearfix"<?php print $content_attributes; ?>>
<?php
  // We hide the comments and links now so that we can render them later.
  hide($content['comments']);
  hide($content['links']);
  print render($content);
?>

  • That's what I am trying to do, renaming it from node.tpl.php to node--front.tpl.php doesn't do anything. The changes are not being displayed after renaming this. I've changed node--front.tpl.php back to it's original name, copied it as homepage.tpl.php and nothing, the changes are not being displayed. – chance Jul 28 '15 at 5:06
1

You have to create page--front.tpl.php from page.tpl.php. You are changing your front page, not the node.

| improve this answer | |
  • Please see the edit section in my question. I am changing the content being displayed in the front page. In page.tpl.php this does not have a title block. – chance Jul 28 '15 at 4:26
  • Pls refer this one stackoverflow.com/questions/12268607/… – Abin Jul 28 '15 at 4:33
  • If the front page is node, the OP request makes sense. In this case, they surely don't want to change the page template. – kiamlaluno Jul 28 '15 at 5:49

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.