Skip to content

Instantly share code, notes, and snippets.

@davoraltman
Last active February 23, 2019 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save davoraltman/98920d5d06aa717cfce2f9559108cb52 to your computer and use it in GitHub Desktop.
Save davoraltman/98920d5d06aa717cfce2f9559108cb52 to your computer and use it in GitHub Desktop.
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' );
@tripflex
Copy link

Automattic/WP-Job-Manager#1662

@davoraltman should return the value, or wrap with ob_start and ob_end_XXX

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