[Resolved] Header Element not working for Search Results page

Home Forums Support [Resolved] Header Element not working for Search Results page

Home Forums Support Header Element not working for Search Results page

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1977027
    Davina

    Hey there!

    Just want to say, I love this theme and appreciate the support that you all provide.

    My question is I have a Header Element where I have my styling set but it is not carrying through to the search result page. It appears everywhere correctly but not on my search result page. The search result page shows the background of the Header Element but the title is not there. With this, the title is not in the header area like the other pages but showing up in the content area – I hoped that made sense…

    Any help would be appreciated!

    #1977086
    Elvin
    Staff
    Customer Support

    Hi Davina,

    Try adding this PHP snippet:

    add_filter( 'generate_page_hero_post_title', function( $post_title ){
    	if(is_search()){
    		$post_title = __( 'Search Results for: %s', 'generatepress' ).'<span>' . get_search_query() . '</span>';
    	}
    	
    	return $post_title;
    },12,1 );

    Here’s how to add php – https://docs.generatepress.com/article/adding-php/

    #1979502
    Davina

    Hi Elvin,

    Worked like a charm! Thank you!

    #1979592
    Elvin
    Staff
    Customer Support

    No problem. 😀

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.