show all WordPress categories in a page

I want to show all WordPress categories in a page.
I use this code:

<?php
$categories = get_categories( array(
‘orderby’ => ‘name’,
‘order’ => ‘ASC’,
‘exclude’ => ‘1,116’,

) );
foreach ($categories as $category) {
echo ‘<div class=”item_product”>’;
// display category image
echo ‘<div class=”image_wrapper is-image”>’;
echo do_shortcode(sprintf(‘[wp_custom_image_category term_id=”%s”]’,$category->term_id));
echo ‘</div>’;
// display category name
echo ‘<div class=”desc_left”>’;
echo ‘<h2 class=”podcast_h2″><a href=” ‘ .get_permalink($category->ID). ‘ “> ‘.$category->name.’ </a></h2>’;
echo ‘</div>’;
echo ‘</div>’;

} ?>

But each category is linked to the same page as the category list
(example.com/list-category)
I want each category link to that category

Read more here:: show all WordPress categories in a page

Leave a Reply

Your email address will not be published. Required fields are marked *