Show Block Depending on Content Type


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. $types = array('blog','story','articles_links'); // put your allowed types in here, one or more.
  3. $showit = FALSE;
  4.  
  5. if (arg(0) == 'node' && ctype_digit(arg(1)) && is_null(arg(2))) {
  6. $node = node_load(arg(1));
  7. if ($node && in_array($node->type, $types)) {
  8. $showit = TRUE;
  9. }
  10. }
  11. return $showit;
  12. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.