我想在一个页面中显示所有WordPress类别。我使用此代码:
<?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>\';
} ?>
但是,每个类别都链接到与类别列表相同的页面(example.com/list category)
我希望每个类别都链接到该类别