edgar.dueñas
Enviado por edgar.dueñas el Mié, 11/05/2016 - 12:41

Listando las ultimas 5 url del tipo de contenido ARTICLE

<?php
global $base_url;
$query = new EntityFieldQuery();
 
echo "<div class='site-map-box-blog'>";
echo "<h2 class='title'>Blog</h2>";
echo "<ul>";
 
//Consultanto el content_type ARTICLE
$result = $query->entityCondition('entity_type', 'node')
            ->entityCondition('bundle', 'article')
            ->propertyCondition('status', 1)
            ->propertyOrderBy('created', 'DESC')
            ->range(0,5)
            ->execute();
 
    if (isset($result['node'])) {
        $news_items_nids = array_keys($result['node']);
        $news_items = entity_load('node', $news_items_nids);
 
        foreach($news_items AS $row){
             $currentUrl = $base_url  . '/'. drupal_get_path_alias('node/'.$row->nid);
             echo '<li><a href=" ' .$currentUrl. ' ">' . $base_url  . '/'. drupal_get_path_alias('node/'.$row->nid) . '</a></li>';
       }
 
}
echo "</ul>";
echo "</div>";
 
?>