How to embed a block (with title) in a template file? I've created some blocks (not related to any other module, just through the "add block" option) and I am attempting to call them in the correct places in my homepage template.

I found the following code:

$block = module_invoke('block', 'block', 'view', '1'); //where 1 is block delta
print $block['content'];


But this only allows me to display the block content. Is there a way to get the block title too? I did find some people using $block['title'] or $block['subject'] but my $block array only seems to have the content in and nothing else.

Apologies if this is a common question but I couldn't seem to find an answer for the life of me!
http://drupal.org/node/26502 - A nice write up on displaying a block using code. There are a couple of examples toward the bottom that show displaying the entire block (including the subject).

One in particular you could try, using Drupal's theme() function:

&lt;?php
    $block = (object) module_invoke('[target_module]', 'block', 'view', "[target_block_ID]");
    print theme('block', $block);
?&gt;