0

How to get the nid from tid, so I can used node_load function then used Field_get_items to fetch particular fields. I used taxonomy_select_node() first but it gives me nids of all nodes related to that tid but I want nids of a particular bundle(content type) so I can display contents only for that content type. Now I am using Entityfieldquery, here is my code:
if(isset($_GET['tid'])){ $id=($_GET['tid']); $query = new EntityFieldQuery(); $query->entityCondition('entity_type', 'node'); $query->entityCondition('bundle', 'escorts_product'); $query->propertyCondition('status', 1); $query->fieldCondition('field_description', NULL, $id, '='); $result = $query->execute(); print "<pre>";print_r($result);
Here I want to get my field_description from my content type escorts_product for a specific $id=tid but it gives me array structure for all tids not for a specific one I mentioned in argument?

1

$query->fieldCondition('field_description', NULL, $id, '=');
line should be replaced like this and it will work,
$query->fieldCondition('field_your_term_reference_field', tid, $id, '=');
then you can get the nid easily.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.