Search excerpts instead of content

Community Forums Forums Design Tips and Tricks Search excerpts instead of content

This topic is: not resolved

This topic contains 3 replies, has 4 voices, and was last updated by  robertbiswas 1 year, 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #95959


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

     * 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
    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";


    Put that file away, open up functions.php.
    courtesy Sridhar Katakam

    Choose your next site design from over 350 Genesis themes.
    Updates via | Twitter | Google+ | Tumblr



    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



    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

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.