小编123*_*123的帖子

获取指定节点类型的最新10篇文章?

现在,如果节点类型是文章.在术语页面左侧,我想显示最新的10篇文章的标题,哪个节点类型是文章.我不想使用意见,我该怎么办?谢谢.

如果我想在节点页面的左边显示最新的10篇文章的标题,哪个节点类型是文章.如何编写查询.非常感谢.

ps:我发现EntityFieldQuery也许可以做到这一点,但我现在不知道如何做到这一点.

我的代码:

$query = new EntityFieldQuery();

$query
 ->entityCondition('entity_type', 'node')
 ->entityCondition('bundle', 'article')
 ->propertyCondition('status', 1)
 ->propertyOrderBy('created', 'DESC')
  ->range(0, 10);

$result = $query->execute();
Run Code Online (Sandbox Code Playgroud)

php drupal drupal-7

2
推荐指数
1
解决办法
1660
查看次数

标签 统计

drupal ×1

drupal-7 ×1

php ×1