Theming Block Contents in Drupal 7
Before blocks get to the theme layer, they can be altered. Blocks are represented as "render arrays", which means you can manipulate them with the Render API.

You can use hook_block_view_alter() to change the contents of a block.

Any module or theme can implement this hook. For example, a theme named YOURTHEME would have code like this:

function YOURTHEME_block_view_alter(&amp;$data, $block) {
  // Remove the contextual links on all blocks that provide them.
  if (is_array($data['content']) &amp;&amp; isset($data['content']['#contextual_links'])) {
    unset($data['content']['#contextual_links']);
  }
  // Add a theme wrapper function defined by the current module to all blocks
  // provided by the "somemodule" module.
  if (is_array($data['content']) &amp;&amp; $block-&gt;module == 'somemodule') {
    $data['content']['#theme_wrappers'][] = 'mymodule_special_block';
  }
}


Or, if you know in advance the module and delta you'd like to alter, you can use hook_block_view_MODULE_DELTA_alter() like this:

function YOURTHEME_block_view_MODULE_DELTA_alter(&amp;$data, $block) {
  // This code will only run for a specific block. For example, if MODULE_DELTA
  // in the function definition above is set to "mymodule_somedelta", the code
  // will only run on the "somedelta" block provided by the "mymodule" module.

  // Change the title of the "somedelta" block provided by the "mymodule"
  // module.
  $data['subject'] = t('New title of the block');
}