[Support request] Separate search archive for custom post type category

Home Forums Support [Support request] Separate search archive for custom post type category

Home Forums Support Separate search archive for custom post type category

  • This topic has 3 replies, 2 voices, and was last updated 3 years ago by Tom.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #565011
    George

    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.2
    GP Premium 1.6.2
    #565110
    Tom
    Lead Developer
    Lead Developer

    Hi George,

    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?

    #565238
    George

    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 .category selector 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.

    #565832
    Tom
    Lead Developer
    Lead 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.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.