get_category – help with linking to each category
-
Hi All,
I’m trying to make a list of categories within my custom taxonomy. So far I have it nearly working, but I can’t get the links to each category to work.
I used this page as a starting point, but the links didn’t work even when I copied that code exactly.
I suspect the problem is that I’m listing a custom taxonomy rather than categories, but I don’t know how to fix it. Any help much appreciated!
Thanks ??
` <?php
$args = array(
‘orderby’ => ‘latest_post’,
‘taxonomy’ => ‘interface_issues’,
);
$categories = get_categories($args);
foreach($categories as $category) {
echo ‘<hr />’;
echo ‘<h2>
<a href=”‘ . get_category_link( $category->term_id ) . ‘ title=”‘ . sprintf( __( “View all articles in %s” ), $category->name ) . ‘” ‘ . ‘>’ . $category->name.'</a>
</h2> ‘;echo $category->description ;
echo ‘<p><a class=”btn btn-default btn-lighter” href=”‘. get_category_link( $category->term_id ) .'” title=”‘ . sprintf( __( “View all articles in %s” ), $category->name ) . ‘”>Read all articles<i class=”fa fa-angle-right”></i></a></p>’;
}
?> `
- The topic ‘get_category – help with linking to each category’ is closed to new replies.