Tagged: Portfolio
Hello,
is it possible to show portfolio category next to portfolio item name on single portfolio item page?
Hi mhrnjak!
You can add something like this on functions.php:
add_filter('avf_title_args','avf_portfolio_title_args', 10, 1);
function avf_portfolio_title_args($args) {
$title = get_the_title($id);
if(is_singular('portfolio')) {
$terms = get_the_terms( $id, 'portfolio_entries' );
$portfoliocat = array();
foreach ( $terms as $term ) {
$portfoliocat[] = $term->name;
}
$args['title'] = $title . ", " . $portfoliocat[0];
} else {
$args['title'] = $title;
}
return $args;
}
This will echo out the first category of the portfolio item.
Regards,
Ismael