I tried to search for a solution and neither drupal.org nor google allowed me to find anything.
I have this node/add list, with a growing list of possibilities (up to 20 content types for editors):
http://www.liftconference.com/node/add/

I would like to:
1) change the order of the content types
2) possibly add 2-3 titles (to group nodes by type, "speak at lift", "request a pass")
3) theme the page

Does anyone know how I could do this?
Thanks

Comments

abhigupta’s picture

I don't know how much experience you have with modules ... but here is what you can do.

1. Find the node/add hook_menu item in the node module.

2. Copy the code to your own custom module and make any modification as necessary.

3. Set the weight of your module to higher than node module.

voilà! Now you have over written node/add page.

ckng’s picture

Instead of modifying the new custom module weight, alternatively you can use a different path and customize the duplicated node_add() to fit your need and use the new path for adding content.

IMO module weight is a grey area which is hard to trace when there is problem.

CK Ng | myFineJob.com
consultation • web design & development • content development • site domain, hosting & maintenance • software design & development

laurenthaug’s picture

Thanks for your answer. I copied the code in a new module but I'm not sure how to proceed from there.
It's amazing this page is not more flexible, it's such a core page for any site.

wflorian’s picture

I am trying to achieve the same thing.

I actually even need to theme the "add node" page just for a certain content type!

I am wondering why there is not more information about this...does anybody have more information about this?

AlexBowman’s picture

I might be a bit late, but here's a simple solution:

In your theme directory create a file called page-node-add.tpl.php.

Whenever Drupal looks for /node/add it'll refer to this file. From here you can theme the page as you'd like. If you not too experienced themeing I'd copy over the contents of page.tpl.php and experiment from there, learning as you go along.

Be aware that changes you make to page.tpl.php will not be applied in page.tpl.php. To keep up consistency you might like to copy lines common to page.tpl.php and page-node-add.tpl.php to a third file, make general changes to your site's page theme in the third file, and call this third file into custom page-whatever.tpl.php pages you make, making only specific changes related to specific pages in specific files.

kurosevic’s picture

can you theme a node add page by content type?

you've got page-node-add.tpl.php

could i do something like this:

page-[contenttype]-node-add.tpl.php?

Cory Goodwin’s picture

Late, but for future surfers who end up at this page.

It would go page-node-add-[content type].tpl.php

For example if your content type was article then the file would be page-node-add-article.tpl.php

manop’s picture

Thank you.

That's perfect. I'm looking for this method for hours.

graceman9’s picture

How can I "preprocess" page-node-add-article.tpl.php?

for test reasons I do something like this in mytheme template.php:

function phptemplate_preprocess_page_node_add_article(&$vars) {
  $vars['test'] = 'URRAAaaa!!!'; // test output variable
}

but it does not work..
drupal 6.x

yultyyev’s picture

For Drupal 7 it would be page--node--add--[content type].tpl.php

Slown’s picture

Great!!! Many Thank's

dapseen’s picture

Thanks for posting it for late surfers 

erichomanchuk’s picture

I wanted to change the how the list wast written not using dl dt dd, in node.pages.inc around line 29 there is the function theme_node_add_list() copy this function to your template.php file and replace with your theme name, I was using root candy.

Here is the themable function from the node.pages.inc file that you need in your template

/**
 * Display the list of available node types for node creation.
 *
 * @ingroup themeable
 */
function theme_node_add_list($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>';
  }
  return $output;
}
asiby’s picture

I think that this topic strayed away from the original question. @laurenthaug wanted to change the page that is listing the node types, not the node entry form itself.

It's probably too late for him now, but I have scheduled some work for creating a module that does just that. It's a pretty simple module. But until then, if any of you is trying to change that list, here are some simple manual tips for you:

  1. Important to know: The list of content types on the node/add page is simply a list of menu items in the Navigation menu under the Add content menu item.
  2. To reorder the content types on the page, or hide some of them, you can simply reorder the corresponding menu items or disable some of them.
  3. You can install the Special Menu Item module and add a few kind of menu items between content types and style them to make them look like group heading. Unfortunately, that's just a quick visual fix and you will need to style them in the admin menu as well if you are using it.
  4. Another important fact is that the node/add page does not show any menu item that is not an immediate child of the node/add menu item. However, the Admin Menu does.
  5. While keeping the "fake content type groupings" described at point #3 above, you can actually duplicate the content types links under the corresponding grouping item (the special menu item). This will make them work nicely in the Admin Menu module (if applicable) ... and they will just be ignored by the node/add page.

My module is going to simply render the node/add page in a way that will allow showing the entire menu tree under the node/add menu with very little code. That way, you will be able to manually inject anything you want between and around the node/add/xyz menu items and they will successfully be reflected on the node/add page.

Thoughts anyone?

Live long ... and prosper!