How to programatically add block to Drupal 7 page tpl AND respect visibility rules? I want to add a block programatically to a page.tpl.php file in my Drupal 7 theme BUT I want it to respect the block's visibility rules.

I'm open to defining new visibility rules in PHP too but it seems whenever I manually invoke a module via code without assigning the block in a region it does not adhere to the block's visibility rules.
Turns out the solution was in how I was rendering the blocks.

Using this code to render my block added the block to Drupal's "knowledge" of the block being on the page.

$block = block_load($module, $bid);
$blockStuff = _block_get_renderable_array(_block_render_blocks(array($block)));
$output = drupal_render($blockStuff);
print $output;