Hi,
I put on my theme function this code to have tags with a shortcode on the pages.
function show_portfolio_tags_func() {
global $post;
$the_tags = get_the_tags( $post->ID , ‘portfolio_entries’);
$output = ”;
foreach($the_tags as $tag) {
$taglink = get_tag_link($tag->tag_id);
$output .= ‘<span class=”portfolio_tag”>‘.$tag->name.’ </span>’;
}
return $output;
}
add_shortcode(‘portfolio_tags’, ‘show_portfolio_tags_func’);
It works and shows the tags, but doesn’t link to them.
Any idea???
Thank you
Hey koomo,
Thank you for the inquiry.
You will have to modify the following line and add the link tag or markup manually.
$output .= ‘<span class=”portfolio_tag”>‘.$tag->name.’ </span>’;
Something like
$output .= '<a class="portfolio_tag" href="'.$taglink.'">'.$tag->name.'</a>';
Best regards,
Ismael
Hi Ismael.
Thank you.
All fine now.
Best,
X.