Display a block on on nodes of type blog.

Public

Warning message

We recommend you to assign at least one category to this snippet so you could easily navigate it in the future. Edit your snippet here.
</> CopyGet raw version
php
  1. <?php
  2. if (arg(0) == 'blog') {
  3. return TRUE;
  4. }
  5. if (arg(0) == 'node' && ctype_digit(arg(1))) {
  6. $node = node_load(arg(1));
  7. if ($node->type == 'blog') {
  8. return TRUE;
  9. }
  10. }
  11. return FALSE;
  12. ?>

Comments

paulbooker's picture

Alternative example ..

  1. // Array of allowed types.
  2. $types = array('blog', 'story');
  3.  
  4. // Check if the current page is a node.
  5. if ((arg(0) == 'node') && is_numeric(arg(1))) {
  6. $node = node_load(arg(1));
  7. return in_array($node->type, $types);
  8. }