How can you access category information from a theme?

Show the category title, description and a url to it’s archive by using it’s category ID:

Get the Ids of the oldest and newest post in that category:

// Get oldest post ID
$posts = get_posts( array(
    'category' => 1,
    'orderby' => 'date',
    'order' => 'ASC',
    'post_type' => 'post',
    'post_status' => 'publish', 
) );
$oldest_post_id = $posts[0]->ID;
// Get newest post ID
$posts = get_posts( array(
    'category' => 1,
    'orderby' => 'date',
    'order' => 'DESC',
    'post_type' => 'post',
    'post_status' => 'publish', 
) );
$newest_post_id = $posts[0]->ID;

Sort an array of category ids by the date of the latest post:

function get_categories_by_the_date() {
    $categories_by_the_date = array();
    $categories = get_categories();

    foreach ( $categories as $category ) {
        $posts = get_posts( array(
            'category' => $category->term_id,
            'orderby' => 'date',
            'order' => 'DESC',
            'post_type' => 'post',
            'post_status' => 'publish', 
        ) );
        $categories_by_the_date[strtotime($posts[0]->post_date)] = $category->term_id;
    }

    krsort($categories_by_the_date);

    return array_values($categories_by_the_date);
}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)