Celebrating 7 Years! Get up to $30 off GeneratePress Premium!

[Resolved] How to customize Search Results template? (to add Relevanssi excerpts)

Home Forums Support [Resolved] How to customize Search Results template? (to add Relevanssi excerpts)

Home Forums Support How to customize Search Results template? (to add Relevanssi excerpts)

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #483724
    Zach

    Hi. I’m using the Relevanssi search plugin and I’d like to highlight search terms inside posts after clicking on a search result.

    To accomplish this, I need to tweak the search results template so permalinks are generated by a custom relevanssi function. (as described here, after the scrolling bit: https://www.relevanssi.com/knowledge-base/scroll-result-page-search-term/)

    I’m having a bit of trouble getting started since GP is so modular: I copied search.php into my child theme, but it uses get_template_part( 'content', 'search' ); to generate the content so it doesn’t help. I see the relevant areas in content.php so I think I should make a content-search.php file with my changes included.

    I’ll need to keep track of any changes to content.php in future GP versions. Is this the most future-proof way to do it?
    Thanks -Zach

    GeneratePress 2.0.2
    GP Premium 1.5.6
    #483975
    Tom
    Lead Developer
    Lead Developer

    Hi Zach,

    That’s exactly correct. Copy content.php and add it to your child theme, then rename it content-search.php.

    Then you can make any necessary changes and you’ll be good to go.

    Let me know if you need more info ๐Ÿ™‚

    #484076
    Zach

    Great. It worked great. Many thanks for a great theme and great support.

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