Block--blog--recent.tpl.php

Trying to display the recent blogs in Drupal 7, I looked under configure for Recent blog posts block and there are only a few options, namely how many to display and the title, then theme regions etc.
So I added the views module and chaos tools so I could add a custom view, but now it’s gone from too little info to too much.
Ideally, I’d just like to overwrite the default block in the theme but when I try to track it down there’s not an actual template to override, I think I’ve isolated the PHP that draws this section, but I need to add the date and teaser. The final image is a preview of what the assignment is expecting.


block–blog–recent.tpl.php

/**
 * Implements hook_block_view().
 *
 * Displays the most recent 10 blog titles.
 */
function blog_block_view($delta = '') {
  global $user;

  if (user_access('access content')) {
    $result = db_select('node', 'n')
      ->fields('n', array('nid', 'title', 'created'))
      ->condition('type', 'blog')
      ->condition('status', 1)
      ->orderBy('created', 'DESC')
      ->range(0, variable_get('blog_block_count', 10))
      ->addTag('node_access')
      ->execute();

    if ($node_title_list = node_title_list($result)) {
      $block['subject'] = t('Recent blog posts');
      $block['content']['blog_list'] = $node_title_list;
      $block['content']['blog_more'] = array(
        '#theme' => 'more_link',
        '#url' => 'blog',
        '#title' => t('Read the latest blog entries.'),
      );

      return $block;
    }
  }
}

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.