How do I create a custom Search Results Page

Community Forums Forums General Discussion How do I create a custom Search Results Page

This topic is: resolved

This topic contains 4 replies, has 2 voices, and was last updated by  Jen Baumann 10 months, 1 week ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #5039

    kategorgeous
    Participant
    Post count: 19

    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
    Only dead fish go with the flow

    #5042

    Jen Baumann
    Keymaster
    Post count: 444

    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.


    If you need technical support for your theme please file a ticket.

    The forums are community based. Staff only monitors the forum for issues relating to the forum itself and to redirect users to where they need to go.

    #5052

    kategorgeous
    Participant
    Post count: 19

    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
    Only dead fish go with the flow

    #5070

    Jen Baumann
    Keymaster
    Post count: 444

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

    [php]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;
    }[/php]

    Create a search.php file and put it in your child theme folder with this content:
    [php]<?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();[/php]

    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.


    If you need technical support for your theme please file a ticket.

    The forums are community based. Staff only monitors the forum for issues relating to the forum itself and to redirect users to where they need to go.

    #89785

    Jen Baumann
    Keymaster
    Post count: 444

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

    [php]<?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();[/php]


    If you need technical support for your theme please file a ticket.

    The forums are community based. Staff only monitors the forum for issues relating to the forum itself and to redirect users to where they need to go.

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.