This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Is there a way to use search parameters as conditional values?

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Is there a way to use search parameters as conditional values? Reply To: Is there a way to use search parameters as conditional values?

#19375
Ernest MarcinkoErnest Marcinko
Keymaster

Well, I had to do some testing to make a semi-working solution, and there might be a way to do it. This is not an easy task, because there is no simple syntax to compare values in a manner such as $field == ‘value’, because the plugin supports multi-instance/multi print layouts, that complicate this a lot.

Nevertheless, I have made the simplest possible solution, which produces a s text printed basically within the first result (but separately), which can be replaced with anything of course. It produces something like this: https://i.imgur.com/6pR6vB4.png

And the code is this:

The important bit is between the
[html]// CONDITION 1 [/html]
and the
[html]// CONDITION 1 END[/html]
lines (22-36).

Basically you can change the $field_name and the $value variables. Then the code will compare the custom field defined in $field_name with the value defined in $value variables.
Then, between lines 31-33 a custom HTML is printed, that is visible on the screenshot as well. I recommend leaving lines 31 and 33 with the DIV element as they are, as it contain important styling to increase the z-index above the overlay of the first item.

You can also make copies of the code between CONDITION bit to make more different conditions with different outputs.

I am not sure how much this helps, but this is the simplest way I was able to get it working.