Support » Themes and Templates » Remove search box [Twenty Eleven]

  • Not finding anything in my search here, where can I find the code to comment out to remove the search box?

Viewing 15 replies - 1 through 15 (of 49 total)
  • Look for this code block in header.php:

    <?php
    // Has the text been hidden?
    if ( 'blank' == get_header_textcolor() ) :
    	?>
    	<div class="only-search<?php if ( ! empty( $header_image ) ) : ?> with-image<?php endif; ?>">
    	<?php get_search_form(); ?>
    	</div>
    	<?php
    else :
    	?>
    	<?php get_search_form(); ?>
    <?php endif; ?>

    Note: I strongly recommend making any changes in a Child Theme.

    Thread Starter jfg69

    (@jfg69)

    Thanks Chip, I am working on a child theme, but cant seem to figure out how to get the changes I already made into the child theme..

    I would be copying the header.php into the child and editing that, correct?

    Thread Starter jfg69

    (@jfg69)

    Searchbox gone, thanks!

    Yep; you got it!

    Howdy! What do I do with the header.php code to remove the search box in my child theme? What part should I delete? I have a separate search widget, and the default search box is hidden in my header image. Thanks for your help!

    Heather

    Look for this bit, I think:

    <?php
    // Has the text been hidden?
    if ( 'blank' == get_header_textcolor() ) :
    	?>
    	<div class="only-search<?php if ( ! empty( $header_image ) ) : ?> with-image<?php endif; ?>">
    	<?php get_search_form(); ?>
    	</div>
    	<?php
    else :
    	?>
    	<?php get_search_form(); ?>
    <?php endif; ?>

    Hi, I had the same question but do not know what to do with the code in order to change it. I have found where it’s located under header.php, but what needs to be done in order to remove the search box completely. I was also wondering if taking this our will allow me to have a header across the whole theme or still up to where the search box was?

    Thanks in advance

    Hi everyone, I was still wondering how to do this and haven’t found the solution yet. Does anyone have some insight to share for this?

    Thanks

    Altairelectronics – if you are looking to simply remove the search box in the header – comment out (or you can delete – but safer to comment out) the sections provided above in the header.php file and it will be gone. This what you’re looking for?

    Chad

    Hello, I also have the same question as Altair. I asked a colleague with an ipad to check as they were having menu wrapping issues. I have removed the search box following these instructions with my child theme. My colleague confirms that the wrapping has stopped and the menu is all on one line with no further menu editing needed.

    Thanks for the code assistance above Chip.

    Thanks everyone, the problem is solved. I didn’t know how to write the code for it but now it’s all fixed and working smoothly.

    Thanks Chip, very easy to follow.
    Now that the search box is gone. How do I place a banner in that position? Could you use html code that would normally used in text widget and place in header.php?

    I handled this a totally different way, and wonder if it is acceptable.

    I went to the “searchform.php” file and moved the “*/” following the comments at the top to the bottom, so that the header is calling an empty file.

    Is this totally a bad way of handling things?

    I read this three times now. So, if it is more safe to comment out would someone mind to explain what you put in your child theme to do so?

    why not edit the css? :

    /* Search Form */
    #branding #searchform {
    	display: none;
    }
Viewing 15 replies - 1 through 15 (of 49 total)
  • The topic ‘Remove search box [Twenty Eleven]’ is closed to new replies.