<div class="col-md-3">
    <h3 class="side-heading">Categories</h3>
    <div class="list-group cat_list"> 
        <?php
        $blogCategoryData = $this->blog->getBlogCategoryRecords();
        foreach ($blogCategoryData as $blogCategory) {
            $countBlogByCategory = $this->blog->countBlogByCategoryId($blogCategory['bg_cat_id']);
            ?>  
            <a href="<?= base_url() ?>blog-category/<?= $blogCategory['slug'] ?>" class="list-group-item "><?= $blogCategory['bg_category_title'] ?><span class="badge"><?php echo $countBlogByCategory ?></span></a>                    
        <?php } ?>
    </div>
    <h3 class="side-heading">Archive</h3>
    <div class="list-group date_list">
        <?php
        $blogArchiveData = $this->blog->getBlogArchive();
        foreach ($blogArchiveData as $blogArchive) {
            $archiveYear = date('Y', $blogArchive['add_time']);
            $countBlogByArchive = $this->blog->countArchiveByTime($archiveYear);
            ?> 
            <a href="<?= base_url() ?>blog-archive/<?= date('Y', $blogArchive['add_time']) ?>" class="list-group-item "><?= date('Y', $blogArchive['add_time']) ?><span class="badge"><?php echo $countBlogByArchive ?></span></a>
        <?php } ?>
    </div>
    <h3 class="side-heading">Recent Blogs</h3>
    <div class="list-group date_list">
        <?php
        $recentBlogData = $this->blog->getRecentBlogs();
        foreach ($recentBlogData as $recentBlog) {
            ?>                   
            <a href="<?= base_url() ?>blog/<?= $recentBlog['slug'] ?>" class="list-group-item "><?= $recentBlog['blog_title'] ?></a>
        <?php } ?>
    </div>
</div>
