November 11, 2015 at 6:38 am #48868
I’m hoping somebody can help me with this. I’m having trouble isolating the states drop down list, I want it on its own outside of the radius/distance search form. I followed the tutorial below and I can get the drop down to appear right with the radius search below the address form field but I can’t figure out how to put the drop down on its own away from the address/distance of the normal search form. The link below says you can put the gmw_states_dropdown( $gmw ); code anywhere in your forms template file to call it but I couldn’t get it work right. I have m made a child search template and that seems to work, just adding the drop down to the template isn’t working for me. I’m not a heavy coder so I kind of need exact instructions on what to do.
Thanks for any help,
AndyNovember 18, 2015 at 11:26 am #48995Eyal FitoussiMember
What happens when you add the functions directly to the search form template file?November 19, 2015 at 5:12 am #49022
Hey thanks for the response, so what I have is this:
In the example you have on that tutorial page in the functions file you have1add_action( 'gmw_search_form_before_distance', 'gmw_states_dropdown', 15 );
Now since I was trying to isolate the drop down on its own, I changed mine to this:1add_action( 'gmw_states_dropdown', 15 );
Then in the search-forms.php template, I have tried copying what I thought would be the right code for the drop down and added1do_action( 'gmw_states_dropdown', $gmw );
However, that produces nothing on the search page, no drop down, no error even, just looks like the regular default search template. The only way I’ve been able to get the states drop down to work is to use your second example where you add the states drop down before the distance field. So if I add this to my functions file1add_action( 'gmw_search_form_before_distance', 'gmw_states_dropdown', 15 );
and do nothing in the searc-forms.php file, then I get the drop down just fine. I just don’t know what to correctly add to the functions file or search template page to get the drop down on its own.
Thanks for any help,
AndyDecember 5, 2015 at 9:04 pm #49347Eyal FitoussiMember
Sorry Andy for missing out your last reply.
At the moment, placing the states dropdown outside the form won’t work. The form must be submitted when the states dropdown changes with the value of the state. That is how the value of the state can pass to the search query.
You will need to customize the script in order to make it work outside the form. Which won’t be very simple.December 6, 2015 at 11:51 am #49366
Okay, well thanks for getting back to me. I’ll have to come up with something else I guess. It would be a nice feature though, if it were a paid plugin I would have bought it immediately.
You must be logged in to reply to this topic.