Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #241835

    Hello,

    is it possible to show portfolio category next to portfolio item name on single portfolio item page?
    category

    • This topic was modified 5 months, 1 week ago by  mhrnjak.
    #242093

    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

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.