Skip to content

Instantly share code, notes, and snippets.

@davoraltman
Created June 3, 2017 23:30
Show Gist options
  • Select an option

  • Save davoraltman/fbcac2ddbfdff815df71ad4b7a582947 to your computer and use it in GitHub Desktop.

Select an option

Save davoraltman/fbcac2ddbfdff815df71ad4b7a582947 to your computer and use it in GitHub Desktop.
function dm_display_wpjm_categories () {
$terms = get_terms( array(
'taxonomy' => 'job_listing_category',
'hide_empty' => false,
) );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
echo '<ul>';
foreach ( $terms as $term ) {
echo '<li>' . '<a href="' . esc_url( get_term_link( $term ) ) . '">' . $term->name . '</a></li>';
}
echo '</ul>';
}
}
add_shortcode('list_categories', 'dm_display_wpjm_categories');
@oakwoodsolutions
Copy link

Hi really new to this. Does this snippet go in functions.php? From a beginner point of view it is always nice to see the filename in the comments. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment