Web Hosting Geeks | Web Hosting Experts
Need help? Call us 1(866)TOP-HOST

14120 reviews 1680 hosting providers

Questions & Answers

WordPress Search only on post pages

Jun 19, 2013 by mike231
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 votes
Jun 19, 2013 by WebProX
Try this code
<?php if(!is_page()){ ?>
<?php get_search_form() ?>
<?php } ?>