Skip Navigation

[Resolved] Hide default label (show all)

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

strong>Problem:
Hide or remove default filter drop-down select option value

Solution:
You need to add custom jQuery code to your view's filter section's JS box to remove the default dropdown filter option.

You can find proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/hide-default-label-show-all/#post-918224

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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 7 replies, has 2 voices.

Last updated by laszloB 6 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#917174

I have a taxonomy filter (dropdown).

[wpv-filter-start hide="false"]
[wpv-filter-controls]
[wpv-control-post-taxonomy taxonomy="jcf-evjarat" type="select" default_label="[wpml-string context='wpv-views' name='osszes-ev']all year[/wpml-string]" url_param="wpv-jcf-evjarat" output="legacy" style="margin-bottom: 15px"]
[wpv-control-post-taxonomy taxonomy="film-kategoria" type="select" default_label="[wpml-string context='wpv-views' name='osszes-filmkat']all film[/wpml-string]" orderby="none" url_param="wpv-film-kategoria" output="legacy"]
[wpv-filter-spinner spinner="<em><u>hidden link</u></em>"]Load[/wpv-filter-spinner]
[/wpv-filter-controls]
[wpv-filter-end]

Is there any chance I'm going to disappear the first item (show all).
In my case: "all year" and "all film"
hidden link

#917332

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - do you mean that you want to remove the default label from your drop-down select filter?

#917467

Yes.
I want to remove first line "show all" from drop-down in frontend (not only label name!).

#917470

Minesh
Supporter

Languages: English (English )

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

To remove default label and option - please use following filter code:

[wpv-control-post-taxonomy taxonomy="jcf-evjarat" type="select" url_param="wpv-jcf-evjarat" output="legacy" style="margin-bottom: 15px"]
[wpv-control-post-taxonomy taxonomy="film-kategoria" type="select"  orderby="none" url_param="wpv-film-kategoria" output="legacy"]

Add following jQuery code to your view's filter section's JS box:

jQuery(document).ready(function($) {
    $("select[name='wpv-jcf-evjarat']").find("option").eq(0).remove();
    $("select[name='wpv-film-kategoria']").find("option").eq(0).remove();
});

Could you please check and confirm it works for you.

#917548

Hi
Thanks for the fast answer.
For me, it works with "standard" view [wpv-view name='film-osszes-view']
But not work with this sortcode: [wpv-form-view name="film-osszes-view" target_id="self"] I use this on right sidebar.
hidden link

#917754

Minesh
Supporter

Languages: English (English )

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

Well - could you please share access details so I will check whats going wrong there.

*** 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.

#918224

Minesh
Supporter

Languages: English (English )

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

Well - could you please check now.

I've added following JS code to your view's filter section's JS box:

jQuery( document ).on( 'js_event_wpv_parametric_search_form_updated', function( event, data ) {
	/**
	* data.view_unique_id (string) The View unique ID hash
	* data.view_changed_form (object) The jQuery object for the View form after being updated
	* data.view_changed_form_additional_forms_only (object) The jQuery object containing additional forms from other instances of the same View inserted using the [wpv-form-view] shortcode
	* data.view_changed_form_additional_forms_full (object) The jQuery object containing additional forms from other instances of the same View inserted using the [wpv-view] shortcode
	*/
	$("select[name='wpv-jcf-evjarat'] option[value=0]").remove();
    $("select[name='wpv-film-kategoria'] option[value=0]").remove();
});

jQuery(document).ready(function($) {
    $("select[name='wpv-jcf-evjarat'] option[value=0]").remove();
    $("select[name='wpv-film-kategoria'] option[value=0]").remove();
});

I do not see the empty option now. could you please confirm.

#918282

Its working! 🙂
Thanks a lot