[Drupal7] How display block programmatically

If you want to display a block in your template:

$block = block_load(<code>$module, $delta</code>);
print render(_block_get_renderable_array( _block_render_blocks( array($block) )));

where:

$module Name of the module that implements the block to load.

$delta Unique ID of the block within the context of $module. Pass NULL to return an empty block object for $module.

Reference links:

 

Tags: ,

Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>