I am creating a theme, and I would like to show each category and its description in front page. I used the following code, but it is only showing one of the categories without a link to its page but a link for home page and also not showing the description.
<h1 class="categoryTitle">
<a href="<?php echo esc_url( $category_link ); ?>">
<?php foreach( (get_the_category()) as $chaine ) {
if($chaine->parent == 0){
echo $chaine->cat_name . ' ';
}
} ?>
</a>
</h1>
<p class="cateSubTitle">
<?php echo category_description( $category_id ); ?>
</p>
How shall I fix this?