早上,即时尝试获取一组最新的节点类型,但似乎无法弄清楚如何按日期排序。继承人我的功能到目前为止:Drupal 7 - entityFieldQuery Order
function latest_nodes($type, $limit = 15, $offset = 0) {
$query = new EntityFieldQuery();
$tmp = $query->entityCondition('entity_type', 'node');
if(is_string($type))
$tmp->entityCondition('bundle', $type);
elseif(is_array($type))
$tmp->entityCondition('bundle', $type, 'IN');
$tmp->range($offset, $limit);
$results = $tmp->execute();
return node_load_multiple(array_keys($results['node']));
}
任何帮助将不胜感激!
哇。第二个参数实际上是“值”。这令人惊讶地难以发现,并且看起来是最常见的用例。 –
@JonSurrell从技术上讲,第二个参数是列名,在大多数情况下默认值为 – Kiee