Last active
February 23, 2019 20:07
-
-
Save davoraltman/98920d5d06aa717cfce2f9559108cb52 to your computer and use it in GitHub Desktop.
Add Display Job Categories Shortcode for a single listing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Automattic/WP-Job-Manager#1662
@davoraltman should return the value, or wrap with
ob_start
andob_end_XXX