I'm building my first drupal site, and I'm aware there's a huge amount about theming that I don't understand. Right now I'm learning to create custom layouts for specific pages by copying and modifying the template file for that page type (e.g., node.tpl.php -> node-—my-content-type.tpl.php). Now I'm trying to modify the "add content" page for a specific content type. Is there a template file that I can copy and modify, and if so, where can I find it? Or does this page type need to be handled differently?

This is in Drupal 7.

What I've tried:

  • Modifying node.tpl.php doesn't affect the add content page, nor does creating and modifying node--add.tpl.php nor node--add--my-content-type.tpl.php.
  • Modifying page.tpl.php does affect the add content page (and all other pages). However...
  • Copying it to page--node--add--my-content-type.tpl.php (as suggested in this question) causes the add content page for my-content-type to not display at all, so apparently there is some other template info that's needed.

2 Answers 2





$variables: An associative array containing:

content: An array of content types.

function theme_node_add_list($variables) {
  $content = $variables['content'];
  $output = '';

  if ($content) {
    $output = '<dl class="node-type-list">';
    foreach ($content as $item) {
      $output .= '<dt>' . l($item['title'], $item['href'], $item['localized_options']) . '</dt>';
      $output .= '<dd>' . filter_xss_admin($item['description']) . '</dd>';
    $output .= '</dl>';
  else {
    $output = '<p>' . t('You have not created any content types yet. Go to the <a href="@create-content">content type creation page</a> to add a new content type.', array('@create-content' => url('admin/structure/types/add'))) . '</p>';
  return $output;

See here


If you just need to modify or theme the node form page of all the node types then you can use:

page--node--add.tpl.php = Add New Node
page--node--edit.tpl.php = Edit Existing Node
page--node--delete.tpl.php = Delete Node

Further reading here Template (theme hook)

If you need it to be specific like:

page--my-article-type--add.tpl.php then use theme suggestion function like something below:

function MYTHEME_preprocess_page(&$variables) {
 global $theme_key;
 $theme_name = $theme_key;
 if (!empty($variables['node']) && !empty($variables['node']->type)) {
  $variables['theme_hook_suggestions'][] = 'page__' . $variables['node']->type;

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.