Skip Navigation

[Resolved] Refering to "Categories" in conditional output

This thread is resolved. Here is a description of the problem and solution.

How to check if specific taxonomy term or category assigned to post.

Using [wpv-conditional] shortcode you can display content conditionally.

In this case, you can find the solution with the following reply.

Relevant Documentation:

This support ticket is created 6 years, 6 months ago. 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.

This topic contains 8 replies, has 2 voices.

Last updated by gaborG 6 years, 6 months ago.

Assigned support staff: Minesh.

conditional output issue.jpg

It is very difficult in many cases to find the actual parameter what I want to base the condition on.
First of all, many of the already deleted custom fields' labels are still among the list of fields to which I can refer. This is probably the reason why I can't seem to reuse those slugs in newly added fields - because the conditional output panel still keeps them as if they were actually in use.

Second, there are 3 categories from which we can choose:
Types Fields
Custom Fields
Views Shortcodes
Well, what if I want to refer to the Categories which is a built-in WordPress feature added to the posts?
Where the hell is that?
Seriously, I couldn't find it. Please tell me which of the uniquely named parameters refers to the Categories?



Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

*** Please make a FULL BACKUP of your database and website.***

To delete custom fields completely, could you please try to follow following steps:
1. If you remove a field from a group, this does not delete the definition of the Field itself
2. To delete the field completely, so to be able to recreate it, we have to follow this steps:
- Head to Types > Custom Fields > Control Custom Fields
- Mark the desired Field with the checkbox and choose "delete" from the DropDown (Bulk Actions)
- Hit "apply" and confirm the action

This will also delete the wp_options entry and enable you to recreate the field with the same slug.

To check taxonomy term with condition, Please try to follow following documentation.

course categories.jpg
discount labels.jpg

Thanks for the link Minesh, I looked it up and I found the way to identify the proper taxonomy.
However, when I add the condition, it changes EVERY instance, not only the ones to which the condition is true.

[wpv-conditional if="( '[wpv-taxonomy-title]' eq '$24 discount' )"]
<div class="discount" style="background-color: #FF6600;">DISCOUNT</div>
[wpv-conditional if="( '[wpv-taxonomy-title]' ne '$24 discount' )"]
<div class="discount" style="background-color: #ccc;"> </div>

I added this Category to 6 of the 14 courses. However, either it shows the orange colored DISCOUNT div to ALL 14, or to none at all.
Am I missing something?



Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Have you checked section "Checking if a post has a specific term assigned" on following link:


Yes, but this doesn't do anything either:

[wpv-conditional if="( has_term('24-discount', 'wpv-taxonomy-slug') eq '1' )" ]
<div class="discount" style="background-color: #FF6600;">DISCOUNT</div>

I added the "has_term" as a registered function, but still nothing.



Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

you may miss something. I would like to check on your install.

Please send me problem URL and which view you are using?

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.



Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Could you please check now:

You have used wrong taxonomy slug.

 [wpv-conditional if="( has_term('24-discount', 'category',null) eq '1' )" ]
      <div class="discount" style="background-color: #FF6600;">DISCOUNT</div>

The discount test is showing now.

I hope above solution will help you to resolve your issue.



Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I hope this issue is resolved.


Yes, thank you Minesh.