Tagged: Lasix In Usa EllApperm
- This topic has 1 reply, 2 voices, and was last updated 2 years, 2 months ago by
Eyal Fitoussi.
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
March 9, 2020 at 1:38 pm #59986
Florian
MemberHello everyone,
I need your support concerning the following issue:
I tried to pre-select a category in my search form and used the code from the following thread:
Code Snippet including my changes:
123456789101112131415161718192021222324gmw_preset_term_taxonomy( $args, $gmw, $taxonomy ) {//verify the form ID.//i changed it from 1 to 2if ( $gmw['ID'] != 2 )return $args;//only apply this if for is not submitted.if ( $gmw['submitted'] == true )return $args;//verify the category dropdown.//change "category" to the taxonomy you'd like to apply the filter for -> I didn't change anything here because category is correctif ( $args['taxonomy'] != 'category' )return $args;//set the selected term that you'd like to pre-set.//I changed the value from 1 to 22 (my pre-selected category)$args['selected'] = 22;//return the new aruments.return $args;}add_filter( 'gmw_pt_dropdown_taxonomy_args', 'gmw_preset_term_taxonomy', 50, 3 );Could you tell me what I am doing wrong?
Maybe this code snippet from 2015 doesn’t work any more?Thanks in advance,
FlorianMarch 9, 2020 at 1:51 pm #59990Eyal Fitoussi
MemberHello Florian,
Please replace your script with the below and see if it works:
123456789101112131415161718192021222324252627function gmw_preset_term_taxonomy( $args, $taxonomy, $gmw ) {// verify the form ID.//i changed it from 1 to 2if ( $gmw['ID'] != 2 ) {return $args;}// only apply this if for is not submitted.if ( $gmw['submitted'] == true ) {return $args;}//verify the category dropdown.//change "category" to the taxonomy you'd like to apply the filter for -> I didn't change anything here because category is correctif ( $args['taxonomy'] != 'category' ) {return $args;}//set the selected term that you'd like to pre-set.//I changed the value from 1 to 22 (my pre-selected category)$args['selected'] = array( 22 );//return the new aruments.return $args;}add_filter( 'gmw_search_form_dropdown_taxonomy_args', 'gmw_preset_term_taxonomy', 50, 3 ); -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.