Hello, how can I get a list of tags (with links) on the individual portfolio items entries?
As a reference imagine I have a portfolio page and this page has tags:
Tag 1
Tag 2
Tag 3
I would like to be able to display this list of tags with their respective links somewhere within the page.
Thanks.
Hi momon!
Your portfolio entries should have the tags displayed by default. Make sure Enfold is updated and send us a link so we can take a closer look. You can set the link as private if you wish.
Cheers!
Elliott
Hi!
Thank you for the link.
Portfolio items built from the advance layout builder will not render tags by default. You can add this on functions.php:
add_filter('avf_template_builder_content', 'avia_add_social_toolbar_template_builder', 10, 1);
function avia_add_social_toolbar_template_builder($content = "")
{
if(is_singular('portfolio'))
{
$content .= '<span class="blog-tags minor-meta">';
$content .= the_tags('<strong>'.__('Tags:','avia_framework').'</strong><span> ');
$content .= '</span></span>';
}
return $content;
}
Cheers!
Ismael
Thank you Ismael, I ended up creating a shortcode for it instead which allowed me to position the tags anywhere in the content instead which is a bit more flexible.
I am sharing my code bellow in case someone wants to do the same:
function psc_pagetags( ){
$t = wp_get_post_tags(get_the_ID());
foreach ($t as $e) {
$psc_tags .= '<a href="' . get_tag_link($e->term_id) . '">' . $e->name . '</a>';
if($e != end($t)) {
$psc_tags .= ', ';
}
}
return $psc_tags;
}
add_shortcode( 'psc_page_tags', 'psc_pagetags' );
By using the shortcode [psc_page_tags] you will get a comma delimited list of linked tags for the current post.
Cheers,