taxonomy_term_load

7 taxonomy.module taxonomy_term_load($tid)
8 taxonomy.module taxonomy_term_load($tid)

Return the term object matching a term ID.

Parameters

$tid: A term's ID

Return value

A term object. Results are statically cached.

11 calls to taxonomy_term_load()

File

modules/taxonomy/taxonomy.module, line 1275
Enables the organization of content into categories.

Code

function taxonomy_term_load($tid) {
  if (!is_numeric($tid)) {
    return FALSE;
  }
  $term = taxonomy_term_load_multiple(array($tid), array());
  return $term ? $term[$tid] : FALSE;
}

Comments

successor of

successor of taxonomy_get_term()

Page template suggestion based on term vocabulary (eg. page--taxonomy--vocabulary_machine_name.tpl.php):

<?php
function theme_preprocess_page(&$variables) {
  if(
arg(0) == 'taxonomy' && arg(1) == 'term') {
       
$tid = (int)arg(2);
       
$term = taxonomy_term_load($tid);
        if(
is_object($term)) {
          
$variables['theme_hook_suggestions'][] = 'page__taxonomy__'.$term->vocabulary_machine_name;
        }
  }
}
?>

Login or register to post comments