WordPress – conditional to determine if search.php page is the current template


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.

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!

, , ralphsmit 3 years 2020-07-06T08:11:20-05:00 0 Answers 68 views 0

Leave an answer