How to remove search bar from a wordpress theme?
closed as off-topic by Dave Romsey, Krzysiek Dróżdż♦, Nathan Johnson, Jack Johansson♦ Apr 27 '18 at 20:11
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?" – Dave Romsey, Krzysiek Dróżdż, Nathan Johnson, Jack Johansson
If the search field is implemented as a widget, this can be done via the administration interface. Just navigate to Appearance > Widgets and drag the search widget from the widget area to the "Available Widgets" pane.
If the search field is hard-coded into the theme, it might be easier to edit the CSS rather than the HTML and PHP. Here's how:
- Use Firebug or a similar tool to locate the DIV element containing the search code.
- In the theme's CSS file (probably style.css), add
display: noneto that DIV. That's it!
This is a minimally invasive approach. If you ever want to re-enable the search bar, just remove the
display: none statement from your CSS.
Try to locate the HTML representing the search bar.
Then find in which theme files it resides (it may be defined in multiple files - single.php, page.php,..)
Remove the markup including the php call from all the files.
You can find it at header.php and just delete it or use CSS attribute "display:none". get_search_form() method represents Search Bar.
<?php // Has the text been hidden? if ( 'blank' == get_header_textcolor() ) : ?> <div class="only-search<?php if ( $header_image ) : ?> with-image<?php endif; ?>"> <?php get_search_form(); ?> </div> <?php else : ?> <?php get_search_form(); ?> <?php endif; ?>