Embed Drupal node form anywhere
Posted on Tue, 10/01/2012 - 13:24
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
Posted on Thu, 15/12/2011 - 23:57
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);
First and Last CSS class to Drupal blocks
Posted on Thu, 15/12/2011 - 13:33
If you're a themer looking to style blocks when its the first or last block in the region, use the following code snippet.
This snippet works with Context module as well.