• 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 do I create a custom Search Results Page

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 › How do I create a custom Search Results Page

This topic is: resolved

Tagged: custom search template

  • This topic has 4 replies, 2 voices, and was last updated 9 years, 3 months ago by Jen Baumann.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • December 13, 2012 at 3:07 pm #5039
    kategorgeous
    Member

    Hi,

    I have been asked to post this question on the forum.  I want the results of my "Search" to be formatted differently and I'm not sure how to do this.

    The way I want it is to give a small list of links (like the search results page on this forum) and not include the date/time/posting details.

    I have managed to remove the date/time and posting details by asking the stylesheet to not display them but I still have the issue where the results give too much information and I only want a few lines of each.

    How do I format my search results page so that it looks more like the search results page like this forum?

    Thanks

    Kate

     


    http://www.underbrella.co.uk
    Learn from yesterday, live for today, hope for tomorrow

    December 13, 2012 at 3:15 pm #5042
    Jen Baumann
    Participant

    So you want just the title and the excerpt? We need more info as to how your site is setup (theme options for blog), including your url.

    December 13, 2012 at 3:52 pm #5052
    kategorgeous
    Member

    Thanks for the quick response.  At the moment (using the Platinum theme) on my website http://www.cathywilcoxtraining.com/ when I do a search then the results page comes up with all the information from the relevant pages (ie the entire page of data) rather than a snippet of information and a "more" link or something.

    Also, if there are no results it says "Sorry, no posts matched your criteria" but I would prefer not to have the word posts there at all.

    Which settings did you mean?

    Thanks

     

    Kate

     


    http://www.underbrella.co.uk
    Learn from yesterday, live for today, hope for tomorrow

    December 13, 2012 at 4:42 pm #5070
    Jen Baumann
    Participant

    That gives me enough info. To filter the No Posts Text:

    add_filter('genesis_noposts_text','custom_noposts_text');
    function custom_noposts_text() {
    $custom_text = "Drat. I really should write about that, shouldn't I? Try another search.";
    return $custom_text;
    }

    Create a search.php file and put it in your child theme folder with this content:

    <?php
    /** Remove the post info function */
    remove_action( 'genesis_before_post_content', 'genesis_post_info' );
    /** Remove the post meta function */
    remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
    /** Removes everything form post content **/
    remove_all_actions( 'genesis_post_content' );
    /** Add your custom content **/
    add_action( 'genesis_post_content', 'custom_post_content' );
    function custom_post_content() {
    	the_content_limit( '800', __( 'Read More &raquo;', 'child_textdomain' ) );
    }
    genesis();

    You can change the 800 to whatever length you want. Note that if you have filtered the Read More in functions.php, the functions.php version will rule unless you also remove the filter here in this file.

    February 11, 2014 at 7:16 am #89785
    Jen Baumann
    Participant

    For HTML5 themes, the search.php would contain the following to show only post titles:

    <?php
    /** Remove the post info function */
    remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
    /** Remove the post meta function */
    remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
    /** Removes everything form post content **/
    remove_all_actions( 'genesis_entry_content' );
    
    genesis();
  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘How do I create a custom Search Results Page’ is closed to new replies.

CTA

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

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 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