## Conditional to determine if search.php page is the current template

Question

I have a specific CSS-file for my search results, so the search.php template. I want a PHP if-condition to determine if the current template is the search.php template, so that I can load that CSS-file with wp_enqueue. The condition should work in the functions.php file.

I’m not entirely sure if I can use is_search() for this. Can anyone confirm I can use is_search() and, if that’s not the case, provide an alternative?

Many thanks in advance!

0
1 year 2020-07-06T12:10:37-05:00 0 Answers 64 views 0