Skip to content

Instantly share code, notes, and snippets.

@JiveDig
Last active July 24, 2024 18:04
Show Gist options
  • Save JiveDig/7646559 to your computer and use it in GitHub Desktop.
Save JiveDig/7646559 to your computer and use it in GitHub Desktop.
Show list of terms from a custom taxonomy linked to their archive pages
<?php
add_action( 'genesis_before_loop', 'spears_do_resource_term_links' );
function spears_do_resource_term_links() {
// Show Custom Taxonomy
$args = array( 'taxonomy' => 'resource_type' );
$terms = get_terms('resource_type', $args);
echo '<div class="resource-types">';
echo '<ul>Sort by Type: ';
foreach ($terms as $term) {
echo '<li><span class="comma">, </span><a href="' . get_term_link( $term ) . '" title="' . $term->name . '">' . $term->name . '</a></li>';
}
echo '</ul>';
echo '</div>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment