I've got a custom post type which displays portfolio items. I display the portfolio category on the page using this code:
<?php
$myterms = get_the_terms($post->ID,'portfolio_category');
foreach ($myterms as $myterm ) {
echo $myterm->slug."\n";
}
?>
Which works fine as long as the portfolio item has a category. If it doesn't I get an error. Is there a way round this?
Thanks
