Skip to content

Instantly share code, notes, and snippets.

@turtlepod
Created August 23, 2017 04:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save turtlepod/d273acc17e582a12ccd4e69d1b9c4a0a to your computer and use it in GitHub Desktop.
Save turtlepod/d273acc17e582a12ccd4e69d1b9c4a0a to your computer and use it in GitHub Desktop.
Listify: Display All Category (not nested) in single listing page
<?php
// Remove Category:
remove_action( 'single_job_listing_meta_start', 'listify_the_listing_category', 30 );
// Use Custom Category:
add_action( 'single_job_listing_meta_start', function() {
$cats = get_the_term_list(
get_post()->ID,
'job_listing_category',
'<span>',
', ',
'</span>'
);
?>
<div class="content-single-job_listing-title-category">
<?php if ( $cats && ! is_wp_error( $cats ) ) : ?>
<?php echo $cats; // WPCS: XSS ok. ?>
<?php endif; ?>
</div>
<?php
}, 30 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment