You are here

function theme_wp_blog_archive in WP Blog - a WordPress-style blogging module. 7

Return HTML for the 'BLog Archive' block, which provides a hierarchical list of years and months, with a count of the number of blog-posts for each month, linking to the view that lists the posts for that year/month.

1 theme call to theme_wp_blog_archive()
wp_blog_block_view in ./wp_blog.module
Implements hook_block_view().

File

./wp_blog.theme.inc, line 12
Theme functions for the WP blog module.

Code

function theme_wp_blog_archive($element) {
  $items = array();
  $items[] = $element['element']['show_all_link'];
  $archive = $element['element']['archive'];
  foreach ($archive as $year) {
    $item = array(
      'data' => t('!year [@count]', array(
        '!year' => l($year['text'], $year['url']),
        '@count' => $year['count'],
      )),
      'children' => array(),
    );
    foreach ($year['months'] as $month) {
      $item['children'][] = array(
        'data' => t('!month [@count]', array(
          '!month' => l($month['text'], $month['url']),
          '@count' => $month['count'],
        )),
      );
    }
    $items[] = $item;
  }
  return theme('item_list', array(
    'items' => $items,
  ));
}