Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add Display Job Categories Shortcode for a single listing
function dm_display_wpjm_single_categories () {
$terms = wp_get_post_terms( get_the_ID(), 'job_listing_category' );
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_single', 'dm_display_wpjm_single_categories');
add_theme_support( 'job-manager-templates' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment