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

Viewing 15 replies - 16 through 30 (of 49 total)
  • Hi Quint,

    Are you saying to put this in the child theme?

    My understanding is that edits should be done in a child theme.

    Thanks,
    Bill

    to make changes (ie. commenting out) to a parent theme file such as header.php, you must copy that file from parent to child and then make the edits. The child theme’s version will be used instead of the parent’s (for theme files other than style.css and functions.php which behave differently)

    As far as css, you can simply write new rules in the child’s style.css

    Maybe I have been unclear. The question is, how to comment out? I keep reading answers on this string saying to do it, but not how. At least with any specifics.

    Lets assume that a child theme is already in place. Lets assume Chips post is the code you want to comment out. What ‘exactly’ do you put in the child theme to comment it out?

    I appreciate your time and patience

    depends on what kind of code you are in…..

    for css:

    /*
    .bitofcode {
           rules: rules;
    }
    */

    for html

    <!-- <a href="blah blah"> blah </a> -->
    
    more code
    
    <!--
    <?php blah blah { ?>
       <blah>
    } ?>
    -->

    for php (as in, within a block of php code)

    <?php {
         code
         code
         // line of code to be ignored
         code
    ?>

    Google for more examples….. there are more

    Does this remove it and then make it a useable space for more page links?
    Or is the space it frees up then unusable?

    My links below my header image sometimes move onto two lines and I’d like to free up a bit of space above so they always stay on the one line.

    Maybe its possible to move the search box over to the right by say 30 pixels?
    Anyone know how to do this?

    For anyone wanting to know how to do this, I have just spent the last 30 minutes on it and now have it sorted.

    A) Make sure you are using a child header.php
    B) Go into your child header.php then highlight and delete all of the code recommended by Chip Bennett on the second post of this thread.
    C) Save your file.
    D) Upload your file.

    Thats it, your search box will now no longer exist.
    You can still use a search box widget as this just gets rid of the one sitting on the navigation section.

    Hi,
    It is always safer to COMMENT OUT your code rather than delete it. It will be easier to trouble shoot later.

    When you want to comment out code, use <!– at the beginning of the code and
    –> at the end of the code, so it should look like this:
    <!–<?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; ?>–>

    To just comment out one line only (to truly make a comment, you can use this:
    //this is just a comment
    However if it goes to a second line then each line you do not want to appear as code needs the // in front of it OR:
    <!–there are a lot of comments so just in case I am going to use the safer mode–>

    If you are commenting out css, use this:
    /*margin-top: 10px;*/

    However, in a child theme if you want to margin-top to be 0, you have to rewrite it to:
    margin-top: 0;

    However, in PHP commenting out code gets tricky, and a bit of research (more than I know since I am a programmer) would be in order.

    I like to upload the file to the child directory first, THEN comment it out or change the code and hit update. That way I can see in real time if the action worked and make changes accordingly.

    Hello, I am trying to follow the directions posted here rather than starting a new question.

    I created my child theme, I commented out the search form, and now there’s a big empty white space there. How do I get the title and subtitle to stop being all crunched up on the left and take that space instead?

    Anyone have any idea how to remove the entire “row” that the search bar was in? For instance, in twentyeleven there is basically a table row that contains the search bar. This thread was helpful in removing the search bar itself, but I still have this unsightly white bar running across the top of my site.

    Any ideas?

    See what I’m talking about at blog.canionphotography.net

    Thanks!

    Actually….

    I was trying to do something else and removed it myself! lol

    I removed this code :

    <hgroup>
    <h1 id=”site-title”><span>” title=”<?php echo esc_attr( get_bloginfo( ‘name’, ‘display’ ) ); ?>” rel=”home”><?php bloginfo( ‘name’ ); ?></span></h1>
    <h2 id=”site-description”><?php bloginfo( ‘description’ ); ?></h2>
    </hgroup>

    From the header.php in my child theme. It did the trick, if anyone else is interested.

    Thank you Stacy, I truly appreciate your help but that didn’t work for me. It removed the entire header text. I want to keep the text, just remove the white space where the search box once was. I want the text of the title and subtitle to take up the whole space at the top. My goal is to make this site very mobile friendly.

    Anyone else have an idea?

    Thank you Chip Bennet you just save my hair from being pulled out. You are the man! Chip!

    Yes, sorry I am not using the header text so getting rid of that entire area was fine with me. I dont see a way to keep the text and get rid of the area.

    Yes, Chip’s fix does work, but it doesn’t “free up” the area where the search box was previously located, once you remove it. That area is still there, a white empty box.

    Hey Stacy, you can also accomplish what you did to your site without messing with code. Just go to your dashboard, and on the lefthand side: appearance, then header, scroll down the right side (big part) and check NO for Display Text. The text will disappear, no coding required. You’ll keep your pic.

    Thank you tammieearl! That works great, and saves my code!

Viewing 15 replies - 16 through 30 (of 49 total)
  • The topic ‘Remove search box [Twenty Eleven]’ is closed to new replies.