Skip to content

Instantly share code, notes, and snippets.

@DonKoko
Created April 17, 2018 10:22
Show Gist options
  • Save DonKoko/67a13d0ec33afa480e7fa73cb5a10fe0 to your computer and use it in GitHub Desktop.
Save DonKoko/67a13d0ec33afa480e7fa73cb5a10fe0 to your computer and use it in GitHub Desktop.
// Shortcode for showing job categories
function dm_display_wpjm_categories () {
$terms = get_terms( array('taxonomy' => 'job_listing_category',
'hide_empty' => false,));
// begin output buffering
ob_start();
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
echo '<ul class="job-categories-wrapper">';
foreach ( $terms as $term ) {
echo '<li>' . '<a class="avia-button avia-color-theme-color avia-size-label" href="' . esc_url( get_term_link( $term ) ) . '">' . $term->name . '</a></li>';
}
echo '</ul>';
}
// end output buffering, grab the buffer contents, and empty the buffer
return ob_get_clean();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment