Does anyone know how to create a node form for specific Content Types? Instead of clicking Content > Add Content > Content Type they can just, I don't know, go to the sidebar and fill out the info there.

This would be great for Content Types which allow Anonymous access like a Testimonials Content Type. There's a short something over at http://goo.gl/LMpSS but it doesn't really explain anything and leaves you wanting for more.

4 Answers 4


I'd recommend using the Form Block module.
This module simply exposes node forms in blocks. You'll get an extra set of options for each content type, which enables/disables the block.

If you need to do it programmatically, node_add() is the best way to go, as suggested by @kiamlaluno.


You can use the code for node_add() as a guideline.

function mymodule_node_form($type) {
  global $user;

  $output = array();
  $types = node_type_get_types();

  if (isset($types[$type])) {
    $node = (object) array(
      'uid' => $user->uid,
      'name' => (isset($user->name) ? $user->name : ''),
      'type' => $type,
      'language' => LANGUAGE_NONE,

    $output = drupal_get_form($type . '_node_form', $node);

  return $output;
  • Good answer, you can also use node_add() directly see my answer below.
    – chim
    Commented Jul 24, 2013 at 14:12
  • I had to add the line module_load_include('inc', 'node', 'node.pages'); in order to get this to work.
    – Felix Eve
    Commented Dec 5, 2013 at 10:30

Shamelessly lifted from SO:


module_load_include('inc', 'node', 'node.pages');
$form = node_add('node_type');

Kudos to @"Marius Ilie"


I didn't try, but I think that you have to create a display (block, content panel, view, etc) and put the drupal_get_form() call in this display.

You can create a display programmatically (hook_block_view() for example), or you can use the Views module. With this module you create a new view (at admin/structure/views), add a display ('block' for example), then you add 'a global text area' (in header or footer) where you past his PHP Code (don't forget to change the formater of the global text, 'Filtered HTML' to 'PHP Code'.

To finish, if you created a block, you can place it where you want (with the admin UI at admin/structure/block).

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.