I want to display content based on term ids using below method.If I include the below code in for loop it works but thats not appropriate way to call loop for each index value.Here $all_children[]
contains term ids. Can anyone please tell me what is wrong with below code , or any suggestions?
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node');
$query->entityCondition('bundle', 'escorts_product');
$query->propertyCondition('status', 1);
for($i=0;$i<=20;$i++)
{
$query->fieldCondition('field_product_sub_cat', 'tid', $all_children[$i],'=');
}
$result = $query->execute();
if (isset($result['node']))
{
print "nomeer";
$nids = array_keys($result['node']);
nodes = node_load(array_keys($result['node']));
if ((node_load($nids, NULL, TRUE)))
{
foreach($nids as $nid)
{
//content
}
}
}