Assign a Pro Header to the Search Results Page

Michael BournePosted:

Themeco’s Pro Header Builder is pretty amazing. From it’s in depth controls to endless styling options, anyone can make a truly magnificent header. But what do you do when the specific page you’d like to target isn’t available as an assignment?

“Search Results” seems to be the common page people mention when this issue comes up. And while there are other pages like custom taxonomies that need some attention, search is one of the wide spread pages we’d all like to target.

This little PHP snippet will do just that. But first, you need to get the post ID of the header you’d like to assign. The easy way to do that is to simply hover over the Edit link in the builder, and take a look at the URL in your status bar. It should look similar to

That 1234 is the post ID you need for this snippet. Place this in your child theme’s functions.php file:

add_filter('cs_match_header_assignment', 'custom_search_header');
function custom_search_header($match) {
	if (is_search()) {
		$match = 1234; // the post ID for your header
	return $match;

Simple as that!

Have a question or a comment about this article? Click here!
About the Author

Michael Bourne


Hey, I'm Michael, and I've been making websites since the mid 90s! These days I focus on Wordpress and would call myself quite handy in PHP, JS, and CSS. Outside of coding and web design, I'm quite fond of craft beer and backpacking around the world.

Share this Tip!

There are no comments

Your email address will not be published. Required fields are marked *