block

Embed Drupal node form anywhere

Simple 1 line of code to embed a Drupal node form anywhere in your site although I would recommend doing it the Drupal way which is creating a custom module for this.

print drupal_render(node_add('NODE_TYPE'));

Where NODE_TYPE is your content type (machine name).

If the code above returns an error that says the function node_add() is undefined, add the following code before it.

Display Drupal block anywhere

Ever wanted to show a Drupal block anywhere in your theme? Use the following code snippet, take note that you will need the module of the block and its delta.

// Load the block region based on module and delta key.
$_your_block = _block_get_renderable_array(_block_render_blocks(array(block_load('MODULE', 'DELTA'))));

// Now we display it.
print render($_your_block);