By aaronp on
I have the term name; how on earth do I get the term ID in a block using PHP?
Simple question; hopefully it's a simple answer ;)
I have the term name; how on earth do I get the term ID in a block using PHP?
Simple question; hopefully it's a simple answer ;)
Comments
how about
how about _taxonomy_get_tid_from_term-- is that simple? ;-)
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
use taxonomy_get_term_by_name()
Marc
-------
http://www.funnymonkey.com
Click. Connect. Learn.
Awesome; this works with one
Awesome; this works with one modification. It looks like taxonomy_get_term_by_name($name) returns an array, which makes sense because the term names are not unique, only the ID's. That is, you might have a term with the same name in two separate vocabularies (or even in the same vocabulary, I suppose?).
This will print the term ID of the first matching term. A better way to do this, of course, would be to loop through all the available options and output 'em.
Thanks again for everyone's help.