Conditions within search results?

I’m building out a search results page, and one of the things I want to do is show a slightly different layout when a couple specific pages show up in the search results.

For example, if the user searched for something that causes the “Tustin” page to show up, display the phone number & other contact info directly in the results listing rather than the standard search result layout.

I’ve set up the archive layout, and everything works fine… however, when I put a div containing the contact info within the overall search result consumer and set the condition to Page (Specific) is Tustin, it just seems to ignore it.

Should the conditions for specific pages work within consumers like I was expecting? Or am I bumping up against a limitation?

Hi @devinelston,

Checked into this and it wasn’t working properly. Fixed for today’s release.

I also made the search elements consistent with the WordPress get_search_form function in that when the page loads the input value will contain the last search query. If you want to disable that you can use this:

add_filter( 'get_search_query', '__return_false' );

#awesomesauce, thanks @alexander!

You’re welcome!

Just confirming that both of these are working for me, thanks again @alexander! I had been holding off on requesting the search_form improvement, so I definitely appreciate that one too :smiley:

Hi @alexander, one little issue. This works as you described, and is great! However, the clear button is not visible until you change something in the search field. For example, after executing the search for “Tustin”, there’s no clear button:

image

Is it possible to have the clear button display automatically when there is text carried over into the search form?

image

1 Like

Good point! Sorry about that. We were missing a class there. I’ve updated the javascript to account for that for the next release.

2 Likes

Thanks @alexander!!

You’re welcome!