This code below displays the current taxonomy term on a taxonomy term page
$current = taxonomy_term_load(arg(2)); ?>
if ($current): ?>
echo $current->name; ?>
endif; ?>
The code below displays the error: "Notice: Trying to get property of non-object in eval() (line 9 of...) Line 9 is "echo $parent->name;"
$parent = taxonomy_get_parents($current->tid);
if ($parent){
echo $parent->name;
}?>
I'm really confused as to why the first set of code works but the 2nd doesn't? "print_r($parent);" displays the info below, so the data is there.
Array ( [3218] => stdClass Object ( [tid] => 3218 [vid] => 12 [name] => NAME OF TAXONOMY TERM [description] => This is the description area [format] => full_html [weight] => 0 [vocabulary_machine_name] => mfr_model [field_displayed_view] => Array ( [und] => Array ( [0] => Array ( [vname] => final_term_pages|testing [vargs] => ) ) ) [metatags] => Array ( [und] => Array ( [title] => Array ( [value] => This is the meta page title ) [description] => Array ( [value] => This is the meta description ) ) ) ) )
taxonomy_get_parents
returns An array of term objects...?$x = array_shift($parent); echo $x->name;
would be one.echo reset($parent)->name;
would be another, etc