- This topic has 3 replies, 2 voices, and was last updated 3 years ago by Tom.
May 1, 2018 at 6:00 pm #565011George
I am displaying a custom post type category archive on my homepage and have targeted certain css classes to act only on the category archive, like making te archive max-width: 100%, etc. When I initiate a search though, the search reults page goes back to the default search archive layout. I would like to keep that layout for the normal blog search but would like to have another search archive only for the homepage that resembles the moficiations I have made for the particular custom post type category archive. Is that even possible? I hope I make sense!GeneratePress 2.0.2GP Premium 1.6.2May 1, 2018 at 9:36 pm #565110TomLead DeveloperLead Developer
I’m not too sure what you mean.
Are you wanting to set the search results container to 100%? But only if your CPT items are within the search results?May 2, 2018 at 2:11 am #565238George
Never thought about it like that but essentially yes.
Basically, I am using Relevanssi to enhance my search. They have a functionality where I can display a shortcode anywhere else on the page and that search input box can limit the search results to a certain custom post type. So I am restricting results to a certain custom post type from the homepage where I also have a category archive displaying a blog grid with items from that custom post type. I have made some CSS changes to that grid, including setting the page to 100%, removing some post meta, etc. Finally I am hiding the site-wide search from the homepage only.
When I search with the restricted search box, the layout search results change the layout. That’s because on the homepage grid, I target the
.categoryselector but when the search arhive gets displayed, that selector is obviously gone. The thing is that I would like to keep the search archive as it is while searching with the sitewide search but only keep the changes I made to the grid on the homepage’s search results.May 2, 2018 at 12:54 pm #565832TomLead DeveloperLead Developer
In that case, you would need to add a body class depending on the CPT being searched by Relevanssi.
Might be worth asking them if something like that is possible – they might have a conditional.
- You must be logged in to reply to this topic.