Create a block in a node.tpl.php file
Declare the region in your theme's .info file:
regions[node_footer] = Node - Footer
In a templatepreprocessnode function, add the necessary code to get the blocks for our defined region:
/**
* Implements template_preprocess_node().
*/
function THEMENAME_preprocess_node(&$variables) {
if ($blocks = block_get_blocks_by_region('node_footer')) {
$variables['node_footer'] = $blocks;
}
}
Now you can render the region in the node.tpl.php file like this:
<?php if (isset($node_footer)): ?>
<div class="region-node-footer">
<?php print render($node_footer); ?>
</div>
<?php endif; ?>
Written by Robin van der Vleuten
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#