Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1320340

    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

    #1320605

    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

    #1320643

    Hi Ismael.
    Thank you.
    All fine now.
    Best,
    X.

    #1320713

    Hi,

    No problem. Please let us know if you need anything else. We will close this thread for now.

    Have a nice day.

    Best regards,
    Ismael

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Tag on portfolio pages’ is closed to new replies.