Help — php code to get first tag into variable
-
Hello;
I am trying to get the text of the first tag into a php variable in a template so I can use it for something. I am trying to do this in single.php (Kubrick). Code looks like this:
<?php $category = get_the_category(); $tag = get_the_tags(); echo $tag[0]->name; ?>That does not work (no echo — nothing). But, $category works just fine when used in a similar way.
I thought I might need to dereference the pointer, but I cannot find a combination that works (I am a php hacker, obviously, not a pro).
Can anyone tell me what is wrong?
Thanks,
Mark
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Help — php code to get first tag into variable’ is closed to new replies.