Archived topic
Page Header titles in Search and Not Found
3 replies · Started by Iban on April 24, 2018
I would love to use {{post_title}} for search results and not found / 404 page titles too
Now those titles appears in the content and {{post_title}} gets empty
I would love the same behavior as it works in archives right now
I think the only proper way would be modifying the plugin because doing [my_own_title_shortcode] seems to break everything and confuse titles or something...
Hi there,
This should work for search: https://generatepress.com/forums/topic/page-header-for-search-results/#post-403642
As for 404, might easier to create a separate page header and just manually insert the title.
Let me know if this helps.
Great
Done this for the new Search Header to show it in my language
function mi_search_func() {
return sprintf( __( 'Search Results for: %s', 'generatepress' ), '<span>' . get_search_query() . '</span>' );
}
add_shortcode('mi_search', 'mi_search_func');
and then css for removing the actual title that is not removed automactly:
.search .page-header {
display: none;
}
Finishing i created a new Page Header for 404. Sounds weird having so much copies of the "same" header but offer much more flexibility in design. I think everything is ok...
Many Thanks!
Glad you've figured it all out!