Reply to comment

Drupal PHP Block Visiblity by Taxonomy Term (Category)

Here's a snippet of PHP code that displays a block if a node has a specific term. You set up the block to display based on the result of PHP code.

<?php
if (arg(0) == 'node' && is_numeric($id=arg(1))) {
  $t = taxonomy_node_get_terms_by_vocabulary(node_load($id),9);
  if ($t[99]) return TRUE;
} else {
  return FALSE;
} ?>

(I'm doing this because the click rate on the Google ads has declined, and the ads, with a few exceptions, like the timesheet software, don't match the content too well. So I'm going to experiment with doing my own placements for affiliate commissions.)

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <b> <dd> <dl> <dt> <i> <li> <ol> <u> <ul> <p> <br> <div> <pre> <code> <img><h1><h2><h3><h4> <blockquote>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

.