• 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

Search excerpts instead of content

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 › Search excerpts instead of content

This topic is: not resolved

Tagged: Excerpt, search results

  • This topic has 3 replies, 4 voices, and was last updated 11 years, 9 months ago by robertbiswas.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • March 21, 2014 at 10:14 am #95959
    Jummul
    Member

    I want search results to show excerpts instead of content. My current search.php from my child theme shows this:

    
    <?php
    /**
     * Genesis Framework.
     *
     * WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances.
     * Please do all modifications in the form of a child theme.
     *
     * @package Genesis\Templates
     * @author  StudioPress
     * @license GPL-2.0+
     * @link    http://my.studiopress.com/themes/genesis/
     */
    
    add_action( 'genesis_before_loop', 'genesis_do_search_title' );
    
    /**
     * Echo the title with the search term.
     *
     * @since 1.9.0
     */
    function genesis_do_search_title() {
    
    	$title = sprintf( '<div class="archive-description"><h1 class="archive-title">%s %s</h1></div>', apply_filters( 'genesis_search_title_text', __( 'Search Results for:', 'genesis' ) ), get_search_query() );
    
    	echo apply_filters( 'genesis_search_title_output', $title ) . "\n";
    
    }
    
    genesis();
    http://www.acupoflife.nl
    March 22, 2014 at 10:55 pm #96127
    Tom
    Participant

    Put that file away, open up functions.php.

    https://gist.github.com/srikat/6912382
    courtesy Sridhar Katakam


    Choose your next site design from over 350 Genesis themes.
    [ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ]

    March 23, 2014 at 9:25 am #96180
    Summer
    Member

    Actually, from a cleaner coding perspective you'd want to create a search.php instead of cluttering up functions.php. Custom templates are your friend 🙂

    All you'd need to do is add this to a custom search.php:

    add_filter( 'genesis_pre_get_option_content_archive', 'sk_show_excerpts' );
    function sk_show_excerpts() {
        return 'excerpts';
    }

    You might also want to play around with which image to display, or display none at all, but that way the code is only called when a visitor does a search, and never anytime else.


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

    April 9, 2014 at 5:51 pm #99406
    robertbiswas
    Member

    Thanks Tom, The hook works great on my genesis child theme. I'm wondering how to add a "read more" link after every excerpt though it's works fine with the title.
    Thanks again

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 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