• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

How to edit the search results template?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to edit the search results template?

This topic is: not resolved
  • This topic has 4 replies, 3 voices, and was last updated 11 years, 4 months ago by robertdabarnes.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • April 14, 2013 at 1:30 am #35345
    robertdabarnes
    Member

    Hi - I'm trying to use Relevanssi for my site search, but part of isn't working (it's replacing the links for tags with /other which is my 'uncategorized' category).

    It looks like it could be because of the following:

    In the search results template, avoid get_permalink(), as it doesn’t work. the_permalink() works and returns the correct permalink. You can use relevanssi_get_permalink(), if you don’t want to echo the permalink directly.

    Please could somebody tell me how to edit my search results template? I did search for instructions in the forum but no luck.

    By the way my site is http://www.superguide.com.au

    Thanks in advance

    Cheers, Rob

    April 15, 2013 at 4:33 pm #35645
    Brad Dalton
    Participant

    You should never edit the core Genesis files.

    Google custom search is a better solution as its far more accurate and easier to customize and install.


    Tutorials for StudioPress Themes.

    April 16, 2013 at 1:39 am #35724
    robertdabarnes
    Member

    Thanks Brad - I've used Google custom search with a different theme but I've had various issues when trying it with Genesis. I don't want to detail them all here because I'd rather just see if there is a way to get Relevanssi to work since it gives me much more control.

    So if Genesis does use get_permalink() whether there is any way that I can change it to the_permalink() without editing the core files? Would this be a custom hook or custom function?

    Cheers, Rob

    April 7, 2015 at 1:33 pm #146956
    asterbird
    Member

    Hi Rob,

    I know this is a little late, but I found a solution and wanted to share...

    I was able to switch out get_permalink() for relevanssi_get_permalink() by adding the following to my child theme's search.php (if you don't have one, copy the one from Genesis core and paste it into your child theme folder):

    //* Modify post titles to add Relevanssi permalink
    // help from http://adamcap.com/code/filter-genesis-h1-post-titles-to-add-for-styling/
    add_filter( 'genesis_post_title_output', 'child_post_title_output', 15 );
    function child_post_title_output( $title ) {	
            // change h2 to h1 depending if you have a search page title or not	
    	$title = sprintf( '<h2 class="entry-title" itemprop="headline"><a href="%s" rel="bookmark">%s</a></h2>', esc_url( relevanssi_get_permalink() ), apply_filters( 'genesis_post_title_text', get_the_title() ) );
    	return $title;
    }

    I was doing Woocommerce as well, so some of this might not apply...

    // Modify content to add Featured Images and Relevanssi permalink
    remove_all_actions( 'genesis_entry_content' );
    add_action( 'genesis_entry_content', 'child_do_post_excerpt' );
    function child_do_post_excerpt() {
    
    	// Get featured image if page or post
    	the_post_thumbnail( 'medium', array( 'class' => 'alignright' ) );
    		
    	// Get featured image if WooCommerce product category
    	global $post;			
    	$thumbnail_id = get_woocommerce_term_meta( $post->term_id, 'thumbnail_id', true );
    	echo wp_get_attachment_image( $thumbnail_id, 'medium', '', array( 'class' => 'alignright' ) );
    	
    	// Get excerpt rather than the_content() so Relevanssi can grab a snippet and highlight search terms
    	the_excerpt();
        
    	// Get 'Read More' link with Relevanssi permalink
        echo '<a class="read-more-link" href="' . esc_url( relevanssi_get_permalink() ) . '">View more »</a>';
    }

    Hope that helps!

    April 7, 2015 at 10:52 pm #147017
    robertdabarnes
    Member

    Thanks Asterbird - I've since moved back to Google Custom Search Engine, but thanks for taking the time to let me know.

    Cheers, Rob

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble