fetch the taxonomy terms inside a particular vocabulary
$taxonomyQuery = new EntityFieldQuery();
$taxonomyTerms = $taxonomyQuery->entityCondition('entity_type', 'taxonomy_term')
->propertyCondition('vid', 2) //change 2 to any vocabulary ID
->propertyOrderBy('weight')
->execute();
foreach($taxonomyTerms['taxonomy_term'] as $term) {
$relevantTerms[] = $term->tid;
}
get a list of nodes that match your criteria
$nodeQuery = new EntityFieldQuery();
$entities = $nodeQuery->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'article') // to target content_type
->propertyCondition('uid', 1)
->propertyCondition('status', 1)
->fieldCondition('field_catetory', 'tid', 2)
->execute();
if($entities) foreach($entities['node'] as $entity){
$node = node_load($entity->nid);
print $node->title;
}
fetch user with profile2 entity
$entityQuery = new EntityFieldQuery();
$entities = $entityQuery->entityCondition('entity_type', 'profile2')
->entityCondition('bundle', 'merchant')
->fieldCondition('field_user_name', 'value', $string)
->execute();
if($entities) foreach($entities['profile2'] as $entity){
$profile = profile2_load($entity->pid);
print $profile->uid;
}
entity_metadata_wrapper
$node = node_load(9999);
$node_wrapper = entity_metadata_wrapper('node', $node);
$node_wrapper->field_body->value(); // return text type
$node_wrapper->field_term->value()->name; // return term object
$node_wrapper->field_link->value()['url']; // return array
$node_wrapper->field_images[0]->value();
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。