Customize Search Results Title

Community Forums Forums Design Tips and Tricks Customize Search Results Title

This topic is: resolved

This topic contains 5 replies, has 3 voices, and was last updated by  Jason Van Divier 4 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #66004

    Jason Van Divier
    Participant
    Post count: 3

    Does anyone have any suggested code I could add to my child theme’s functions.php or elsewhere to customize my search results title? Currently there is no title displaying. I would like to add something like

    Search Results for: Match Search Query

    I am using the Genesis theme.

    http://www.calvarychapelparker.com
    #66072

    Sridhar Katakam
    Participant
    Post count: 851

    I just tested Genesis Sample child theme with the latest Genesis and search pages automatically show:

    Search Results for: <searched term>

    Is upgrading your Genesis to the latest version a option?


    #66164

    Jason Van Divier
    Participant
    Post count: 3

    Hi Sridhar, thanks for your reply. The developer asked me not to update Genesis. I have looked at the Genesis files and it appears all the changes were made in the child theme, but perhaps there is something in the Genesis framework he doesn’t want to change. I would like to update, but I better not until he is around and can fix it if it breaks. He is busy, so I am attempting to make the changes I can on my own. I was thinking I could add a function or filter to the child functions.php. I added a function to change the default no posts message, which worked, but I haven’t been able to come up with anything for the title that works yet.

    #80358

    CathyEarle
    Participant
    Post count: 48

    I have the same issue with the search results showing “Search Results for:” there is no result test when I search using the “Taxominies Filter” plugin. Also it appears on top of a large white box.

    How can I change the formatting and wording of this – remove the “for” and remove the white background/large padding around the search results?

    #80585

    Sridhar Katakam
    Participant
    Post count: 851

    @Cathy: Can you provide the URL of a sample search results page in your site?


    #80624

    Jason Van Divier
    Participant
    Post count: 3

    I was able to customize the search results title by adding the following to the bottom of my child functions.php:

    add_filter( ‘genesis_search_title_output’, ‘my_custom_search_title’ );

    function my_custom_search_title( $title ) {

    $prefix = “Search Results for: “;
    $suffix = “”;

    $title = sprintf( ‘<h1 class=”entry-title”>%s%s%s</h1>’, $prefix, get_search_query(), $suffix );

    return $title;

    }

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

You must be logged in to reply to this topic.