This support ticket is created vor 5 Jahre, 3 Monate. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
ok, i found the issue, the tag is being converted into capital letters . from luxury > Luxury . is this normal ?
if i were to use many conditional code for tags will it affect the performance of the site, loading etc ?
The number of conditional blocks that you'll have with "has_term" function, will result in more processing time. To optimize this, you can use the "get_the_tags" function ( ref: https://developer.wordpress.org/reference/functions/get_the_tags/ ) to get all attached tag terms in a custom shortcode at once and then generate the markup/HTML accordingly.
1. If your requirement is to check whether an individual tag term is attached or not, then you'll continue on using your current approach of using the "has_term" function in a conditional block.
I suggested using tag term's slug instead of a name because slug is in all small letters and empty spaces are replaced by "-".
( example screenshot: hidden link )
For example, your code:
This is [wpv-conditional if="( has_term('tags 2', 'product-tag', null) eq '1' )" ]tag 2[/wpv-conditional]
Will become:
This is [wpv-conditional if="( has_term('tags-2', 'product-tag', null) eq '1' )" ]tag 2[/wpv-conditional]
Since the slug of your tag with name "tags 2" or "Tags 2" will most likely be "tags-2".
2. On the other hand, if your goal is to show all the attached tag terms to a post, you can show them all at once, without having to add a conditional check for each term.
To show the terms from product tags taxonomy in your view, you'll be able to use the shortcode inside your view's loop like this:
[show_attached_tags tax="product-tag"]
Note: I've used "get_the_terms" function in the example instead of the "get_the_tags", because the "get_the_tags" only works with the post tags taxonomy.
Thanks for clarifying that and yes, for a consolidated statement involving multiple tags, your current approach (of using multiple conditional blocks) is the way to go.
You're welcome to close this ticket and open a new one for a different issue/question.