Skip Navigation

[Resolved] Conditional output for dropdown menu

This support ticket is created 3 years, 5 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by Lisa Boyd 3 years, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#2164499

Tell us what you are trying to do?
I have a Category dropdown menu that is being automatically generated by imported content (Apparel, Axles, Doors, etc.). I have used the conditional html output to remove the Category Apparel from the loop, but I need to know how to remove it from the dropdown menu as well.

The dropdown menu is being displayed with the following:
<div class="form-group">
<label for="wpv-wpcf-category">[wpml-string context="wpv-views"]Category[/wpml-string]</label>
[wpv-control-postmeta type="select" field="wpcf-category" default_label="Select Category" url_param="wpv-wpcf-category"]
</div>

But when I put conditional output around the wpv-control-postmeta, it doesn't do anything to remove those options from the dropdown. Is there another way to hide categories?

Is there any documentation that you are following?
https://toolset.com/documentation/legacy-features/views-plugin/conditional-html-output-in-views/

#2165325

Hello,

How do you setup the custom field "category"?

If it is a custom select field created with Toolset Types plugin, you can find and edit it here:
Dashboard-> Toolset-> Custom Fields, find and edit the specific field group, find and edit the custom field "Category", and remove the option "Apparel"

And you can use custom CSS codes to hide option "Apparel" in frontend, for example:

select[name="wpv-wpcf-category"] option[value="Apparel"]{
	display:none;
}

Please replace "Apparel" with the "Apparel" option value

#2168907

Thank you so much for the help!