I have this code in a page in the WP for show new taxonomy
<?php
$terms = get_terms(array(
'hide_empty' => 'false',
'orderby' => 'name',
'order' => 'ASC',
'taxonomy' => 'mylist'
));
foreach ($terms as $category) {
echo '<div class="col-ms-4">';
echo '<div class="category-list">';
echo '<a href="' . get_category_link( $category->term_id ) . ' "><div class="image_wrapper is-image list-image">'. do_shortcode(sprintf('[wp_custom_image_category term_id="%s"]',$category->term_id)). '</div></a>' ;
echo '<div class="image-category"><h2 class="title-category"><a href=" ' . get_category_link( $category->term_id ) . ' "> '.$category->name.' </a></h2></div>';
echo '<div class="category-count"><a>' . $category->count . '</a></div>';
echo '</div>';
echo '</div>';
} ?>
but this is not working. Do you have an idea to display new taxonomies on the WordPress? Using this code
I have this code in a page in the WP for show new taxonomy
<?php
$terms = get_terms(array(
'hide_empty' => 'false',
'orderby' => 'name',
'order' => 'ASC',
'taxonomy' => 'mylist'
));
foreach ($terms as $category) {
echo '<div class="col-ms-4">';
echo '<div class="category-list">';
echo '<a href="' . get_category_link( $category->term_id ) . ' "><div class="image_wrapper is-image list-image">'. do_shortcode(sprintf('[wp_custom_image_category term_id="%s"]',$category->term_id)). '</div></a>' ;
echo '<div class="image-category"><h2 class="title-category"><a href=" ' . get_category_link( $category->term_id ) . ' "> '.$category->name.' </a></h2></div>';
echo '<div class="category-count"><a>' . $category->count . '</a></div>';
echo '</div>';
echo '</div>';
} ?>
but this is not working. Do you have an idea to display new taxonomies on the WordPress? Using this code
The functions such as get_categories
are unique to the post category taxonomy. "Category" is a taxonomy term. If you register your own taxonomies, you need to use get_terms which has similar parameters to your get_categories function.
$terms = get_terms(array(
'hide_empty' => false,
'orderby' => 'name',
'order' => 'ASC',
'taxonomy' => 'your-taxonomy'
));