Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1266363

    Hi,

    i would like to add tags below my post. If poissible automaticly or with shortcode?

    How ca i do that?

    Kind regards
    Jak

    #1267360

    Hey Jak73,

    Thank you for the inquiry.

    You can use the following snippet in the functions.php file to create a custom shortcode that renders the post tags.

    /* shortcode to render post tags */
    function post_tags_shortcode()
    {
    	global $post;
    	$tags = get_the_tags($post->ID);
    	$separator = ' ';
    	$output = '';
    	if (!empty($tags)) {
    		foreach ($tags as $tag) {
    			$output .= '<a href="' . esc_url(get_tag_link($tag->term_id)) . '" alt="' . esc_attr(sprintf(__('View all posts in %s', 'textdomain'), $tag->name)) . '">' . esc_html($tag->name) . '</a>' . $separator;
    		}
    	}
    	return trim($output, $separator);
    }
    add_shortcode('sc_tag_category', 'post_tags_shortcode');
    
    You can now use the [sc_tag_category] shortcode to display the tags inside the post.
    

    In the advance layout builder, add a code or text block, then use the [sc_tag_category] shortcode to render the tags.

    Best regards,
    Ismael

    #1268669

    Hi Ismael,
    thank you very much, i will try that.

    Kind regards Jak

    #1268730

    Hi,

    Did you need additional help with this topic or shall we close?

    Best regards,
    Jordan Shannon

    #1268746

    Hi Jordan,
    yes, some more help needed.

    How can I style the tags to the enfold portfolio theme. Would be nice, when I have a more like a button style for the tags?

    Kind regards Jak

    #1269012

    Hi,
    Thank you for the link to your post, but I don’t see the tags, are you using the above shortcode?
    We will need to see the element so we can help style it. Would you like the tags styled like your social share buttons?

    Best regards,
    Mike

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.