What code do you need to insert so that the search box only appears on the home page? Where exactly do you need to place it? Which .php file? Thanks
What code do you need to insert so that the search box only appears on the home page? Where exactly do you need to place it? Which .php file? Thanks
It depends on where is your searchbox (header, sidebar, etc.) in your theme.
Once you find the code, use conditional tags to show the search box only in the homepage:
<?php if ( is_front_page() ) {
// Search box code
} ?>
Thank you. Where is the widget search code usually found? I have a "middle" widget. Once I find the code, where do I locate it exactly?
If the search box is a widget, you must use a plugin such as widget logic. In the search widget option put is_front_page(). Note that this only applies if you used a widget to insert the search box (Appearance > Widgets > drag the box to the sidebar).
http://wordpress.org/extend/plugins/widget-logic/
If the searchbox is hardcoded to your theme, you have to locate the code (most likely it's in sidebar.php, judging by what you said) and:
Put
<?php if ( is_front_page() ) { ?>
before it starts...
...and
<?php } ?>
after it.
This topic has been closed to new replies.