WordPress Search only on post pages

23 views
asked Jun 19, 2013 in Website Builder by mike231 (2,480 points)
Hello
I am using a Twenty Twelve child theme and  I am trying to make the search box display on the posts pages only. I used this code in my header.php file
<?php
if
(is_single($post)) : get_search_form();
endif
?>
But this code didn’t work.
Does anyone know how to do this?
Thanks and regards

1 Answer

0 like 0 dislike
answered Jun 19, 2013 by WebProX (12,200 points)
Try this code
<?php if(!is_page()){ ?>
<?php get_search_form() ?>
<?php } ?>
...