Hi!
I have a taxonomy with bird names. I also have several nodes, and one for each term. What I want is to always redirect the link of the term to that node that has the same title as the taxonomy term. I imagine I need to write some PHP query to get the nid and build the URL... any more help?
Thanks!

Comments

agileware’s picture

Status: Active » Fixed

As of version 5.x-1.3 there are two variables available to your php code when using it to make a path. They are $tid and $tname. They are strings for term ID and term name respectively.

You can use these to do what you want.

For example:

  $node = node_load(array('title' => $tname));
  return 'node/' . $node->nid;

That will take you to the node with the title the same as the term name.

It will work properly if you only have one node with the title of the term name. If you have multiple with the same title you will have to do other things to get the one you're after.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.