asked 10 years ago

I need to print the category along with the data for each project in the portfolio section.
I was trying to include a span or simply a p, with the call to the project category in shortcodes.php, when you make the project caption (line 367), but I don’t know how to call to the project category cause neither get_category nor get_term is working here.
Could you help me!
Thanks so much!

1 Answers
answered 10 years ago

Hi Hellover, 
To get project category please open shortcode.php file in /wp-content/themes/dw-page/inc/shortcodes.php then add bellow code like following screenshot 

     $project_category = '';
$terms = get_the_terms( $project_id, 'project-category' );
if ( $terms && ! is_wp_error( $terms ) ) :
$draught_links = array();
foreach ( $terms as $term ) {
$draught_links[] = $term->name;
$project_category = join( ", ", $draught_links );
     <p class="meta">'.$project_category.'</p>

Hope this helps !

replied 10 years ago

It’s working perfectly.
Very thanks Wilfred!

Powered by DW Question & Answer Pro