Showing block in specific urls and content types I'm using this code to show block in specific urls and content types.

&lt;?php
  $match = TRUE;
  // block is visible on the content types entered here
  $types = array('product_display' =&gt; 1, 'page' =&gt; 1);
  $url = request_uri();
  if ((arg(0) == 'node') &amp;&amp; is_numeric(arg(1))) {
    $node = node_load(arg(1));
    $match = isset($types[$node-&gt;type]);
  }

  if (strpos($url, "somewhere")) {
    $match = TRUE;
  }
  // copy paste these for additional URLs
  $tids=array_keys(taxonomy_get_children(7));
  foreach($tids as $tid) {
    if (strpos($url, "taxonomy/term/".$tid)) {
      $match = TRUE;
      break;
    }
  }
  return $match;
?&gt;


It works but the block shows in some other urls too, any idea why?
You could do one more thing over it.

Just remove the block from the assigned region and render that block using module_invoke() in the template file page.tpl.php.

&lt;?php
  $match = TRUE;
  // block is visible on the content types entered here
  $types = array('product_display' =&gt; 1, 'page' =&gt; 1);
  $url = request_uri();
  if ((arg(0) == 'node') &amp;&amp; is_numeric(arg(1))) {
    $node = node_load(arg(1));
    $match = isset($types[$node-&gt;type]);
  }

  if (strpos($url, "somewhere")) {
    $match = TRUE;
  $block = module_invoke('block', 'block_view', 'block_delta');
  print $block['content'];
  }


Render your block with the applied condition as you want.
If you just want to display block at some specific urls and content types.

It works well for that!