Forums Forums Search & Filter Pro Search Results Title in Genesis Child Theme

Viewing 5 posts - 1 through 5 (of 5 total)
  • Anonymous
    #124673

    My problem sounds close to these two. But I can’t find anything that works.

    How to set a title for every search
    https://support.searchandfilter.com/forums/topic/how-to-set-a-title-for-every-search/

    Update search results page title
    https://support.searchandfilter.com/forums/topic/update-search-results-page-title/

    I am trying to get a Search Results title instead of just having ‘Search Results for:’ with nothing following it. I am reading up on different themes — I am running Genesis and Yoast. I added the WP code that I believe is supposed to affect this, but it did not work.

    https://www.designsandcode.com/documentation/search-filter-pro/search-results/as-an-archive/#Update_Page_Title

    So, when I select an item (‘Attention’) from a custom taxonomy (a dropdown with 15 items). I get the correct results, but no search title.

    The search title should read, ‘Search Results for: Attention.’

    But instead it reads, ‘Search Results for:’

    I’m showing results as ‘an archive,’ I use a custom template ‘search.php’ (which is not custom, it’s just the Genesis default). I know that when I try to use a custom slug, everything breaks. This looks like a separate issue.

    Ajax is not turned on

    MODERATOR — “The Title on the search page is a theme issue and you may have to hand code it in the template file you use. Some themes make it very hard to add in any other way.”

    Okay, I created a copy of ‘search.php’ and called it ‘search-filter.php’ here is the code. I am not sure how to modify it.
    ———————————-

    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";
    
    }
    
    genesis();
    Trevor
    #124680

    I edited your post to put that code in a code block.

    I think this would be the new code:

    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', 'genesis' ) ), get_search_query() );
    
    	echo apply_filters( 'genesis_search_title_output', $title ) . "\n";
    
    }
    
    genesis();
    Anonymous
    #124738

    Thank you so much for getting back to me so fast! The new code removes the “for:” but does not provide a label for what I am searching for. So it is the same problem.

    This only occurs on the custom taxonomies of which there are four. I also have a Type Any Term field box via Search and Filter Pro as an option. When I type a term there, such as “Wallingford”, a full search title is returned in Search results: “Search Results for: Wallingford”

    I also just added a non-custom taxonomy “All Categories” to see if the same behavior. It is. The selected item in the dropdown does not appear in Search Results title.

    Trevor
    #124764

    If I understand, you are trying to output at the top of the page what our search plugin has just searched for. This is possible, but quite complex and requires custom coding. It would be further complicated (and might not be possible) if you are using Ajax to update the search results, as the part of the page with the title might not be in the part of the page that the Ajax refreshes.

    The more complex that your search is, the more difficult it will be to achieve what you want. The advantage of the standard WordPress approach, which Genesis uses, is that there is only one thing being searched for, a single search term or phrase, and only searched for with a simple text entry field.

    I have provided other users with the basic code to get them started, but from there onwards would require custom coding, with which you would need to hire a 3rd party coder to help you.

    We do intend to add a feature to the plugin to make this much simpler, possibly with the next major release, V3.

    Some related previous threads:

    https://support.searchandfilter.com/forums/topic/how-to-set-a-title-for-every-search/
    https://support.searchandfilter.com/forums/topic/how-to-show-the-currently-selected-title-only/
    https://support.searchandfilter.com/forums/topic/showing-the-search-query/
    https://support.searchandfilter.com/forums/topic/results-displayed-results-count-searched-tag-associated-categories/

    Anonymous
    #124945

    Okay, I understand simple vs. complex search now. Thank you for explaining. No, I am not running Ajax. I have been testing mainly just based on one item selected from one custom taxonomy, but the reality is there are at least three more options (from custom taxonomies) a person could choose as well, making the title of what I just searched for much more complex from a backend creation standpoint. It is an interesting issue that I did not consider beforehand. This is the first client need I have had for filtered results.

    I guess there is the option of at least making the language show up a little friendlier, “Your Search Results:” (which implies looking below) So I can just change that.

    Thank you so much for your help on this issue. You can close this thread.

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