Sorry to open issue again. Thanks andreiashu to point to the right direction for adding child link in node.tpl.
It's working if you put parent_id manually. How you get parent id from current node? In my case I used:

print l("Add new child node", 'node/add/content_type', array('query' => array('destination' => 'node/[parent_id]/children', 'edit[parent]' => '[parent_id]')));

I'm getting link as following:

node/add/content_type?destination=node/[parent_id]/children&edit[parent]=[parent_id]

Any help will be appreciated.

Original post:

node/add/[node_type]?destination=node/[parent_nid]/children&edit[parent]=[parent_nid]
Where:
- [node_type] is the node type of the child you want to add
- [parent_nid] is the node id of the parent
- [parent] you let it as it is (literally)

For the l function you can write like this:
l("Add new child node", 'node/add/[node_type]', array('query' => array('destination' => 'node/[parent_nid]/children', 'edit[parent]' => '[parent_nid]')))

Comments

markhalliwell’s picture

Component: Code » Drupal/PHP Code

Copy & Pasted: This issue pertains to the 6.x-1.x branch which is now legacy and is over two years old. If this issue is not applicable anymore, please consider closing it. Otherwise, please update this issue appropriately. Will be closed in two weeks if no response.