Skip to content

Commit

Permalink
Fix error when categories aren't being used
Browse files Browse the repository at this point in the history
  • Loading branch information
coenjacobs committed Jul 15, 2016
1 parent 8fb2fcb commit 73ee4a4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions helpers/template.php
Expand Up @@ -114,6 +114,11 @@ function listings_get_resized_image( $logo, $size ) {
function listings_get_terms_links_string($post, $taxonomy)
{
$categories = wp_get_post_terms($post->ID, $taxonomy);

if ( empty($categories) || is_wp_error($categories ) ) {
return '';
}

$categories_array = array_map(function ($item) {
$permalink = get_term_link($item);
return '<a href="' . $permalink . '">' . $item->name . '</a>';
Expand Down

0 comments on commit 73ee4a4

Please sign in to comment.