• 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

Displaying only post titles in search results

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 › General Discussion › Displaying only post titles in search results

This topic is: resolved
  • This topic has 5 replies, 2 voices, and was last updated 12 years, 6 months ago by David Chu.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • April 3, 2014 at 8:47 am #98289
    pixelhappy
    Member

    Hello.

    I saw a handful of posts asking this same question here in the forums but never really found an answer.

    Which is why I am posting this question again.

    Would love to be able to display only post titles on search results and after Google ing for a few hours, I'm still not sure how to do this.

    Any ideas would be appreciated!

    Thanks, Yael


    Web developer. WordPress and Genesis Junkie. Yoga lover and aspiring peace maker.

    April 3, 2014 at 10:14 am #98301
    David Chu
    Participant

    Hi Yael,
    I found that to be an interesting question. WP search, as you probably found in your Googling, is funky. 🙂

    The general thing you need to do is to make a search.php file in your child theme. This will override the stock WP results. Here is an example of code that you can try. It's pretty generic and easy to follow. As you can see, it just uses the title and the link, no "content" or other bits.

    Take the following code, save it as a file named search.php, and then upload it to your child theme's folder. I tested it, and it works great.

    <?php
    /**
     * Search Results Template File
     */ 
    get_header(); ?>
    	<header>
    		<h1>Search Results: "<?php echo get_search_query(); ?>"</h1>
    		<br>
    	</header>
    <?php if ( have_posts() ) :  // results found?>
    	<?php while ( have_posts() ) : the_post(); ?>
    		<article>
    			&lt;p&gt; <a href="&quot;&lt;?php">&quot;&gt;&lt;?php the_title();  ?&gt;</a> &lt;/p&gt;
    		&lt;/article&gt;
    	&lt;?php endwhile; ?&gt;
    &lt;?php else :  // no results?&gt;
    	&lt;article&gt;
    		&lt;h1&gt;No Results Found.&lt;/h1&gt;
    	&lt;/article&gt;
    &lt;?php endif; ?&gt;
    &lt;?php get_footer(); ?&gt;
    

    Cheers, Dave


    Dave Chu · Custom WordPress Developer – likes collaborating with Designers

    April 3, 2014 at 11:43 pm #98400
    pixelhappy
    Member

    Thanks for this Dave. When I try this, though, I get an error message on the search results page:

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/kitche11/public_html/wp-content/themes/dynamik-gen/search.php on line 19

    Wonder why it works for you and not me ? I"ll double check the code I added and see if I somehow copied over incorrectly.

    Thanks for helping out here.

    Yael


    Web developer. WordPress and Genesis Junkie. Yoga lover and aspiring peace maker.

    April 4, 2014 at 7:42 am #98435
    David Chu
    Participant

    Yael,
    Glad to help.

    Ah, I think I see what happened. You did nothing wrong, and even though you're apparently using Dynamik, I think this method should still work. btw, this is a regular WordPress method, not a Genesis-specific procedure.

    This forum software butchers code, even when you use the tags they tell you to use. Pop over here and try that code instead. 🙂

    Cheers, Dave


    Dave Chu · Custom WordPress Developer – likes collaborating with Designers

    April 4, 2014 at 7:53 am #98439
    pixelhappy
    Member

    Wahoo, thank you Dave! I so appreciate your help -- works like a charm :0


    Web developer. WordPress and Genesis Junkie. Yoga lover and aspiring peace maker.

    April 4, 2014 at 8:02 am #98441
    David Chu
    Participant

    Super! Good to meet you.

    Dave


    Dave Chu · Custom WordPress Developer – likes collaborating with Designers

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘General Discussion’ 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