WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] How to change the submit button from “Search” to “Go”

[Resolved] How to change the submit button from “Search” to “Go”

  • Moderator t-p

    @t-p

    hi everybody,

    Seeking guidance – how do I change the name of the search submit button from “Search” to “Go”.

    Thanks.

    tara

Viewing 9 replies - 1 through 9 (of 9 total)
  • When your Searchbutton is in your left-sidebar go into your theme files and find left-sidebar.php in there find this:

    <form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <input type="text" name="s" id="s" size="19" /><input type="submit" value="<?php _e('Search'); ?>" />
    </form>

    and change Search to Go

    esmi

    @esmi

    Forum Moderator

    Create your own search form template (named searchform.php) and place it in your theme.

    <form method="get" id="searchform" action="<?php bloginfo('url'); ?>">
    <div>
    <label for="s">Keyword(s)</label> <input class="text" type="text" value="<?php if(trim(wp_specialchars($s,1))!='') echo trim(wp_specialchars($s,1));else echo ' ';?>" name="s" id="s" />
    <input type="submit" class="submit" name="Submit" value="Search Site" />
    </div>
    </form>
    Moderator t-p

    @t-p

    Thanks esmi,excellent!

    I followed your suggestion. I works great.

    Question: How do i adjust the width of the search box? Does not matter what I do, It stays the same.

    in style.css, there is this:

    `#sidebar #searchform #s {
    width: 108px;
    padding: 2px;
    }`

    Even if I change that to zero, it does not change the width.

    I have moved the search from the sidebar (default theme) to the horizontal bar.

    Please guidee how I can change the width of the search box.

    Thanks esmi again.

    tara

    #searchform #s .input{
    width: 50px;
    }

    does this do anything if added to your css?

    or…does adding a size value here do it?
    <label for="s">Keyword(s)</label> <input class="text" size ="20" type="text" value="<?php if(trim(wp_specialchars($s,1))!='') echo trim(wp_specialchars($s,1));else echo ' ';?>" name="s" id="s" />

    Moderator t-p

    @t-p

    Thanks RVoodoo,

    #

    searchform #s .input{
    width: 50px;
    }does this do anything if added to your css?

    adding size value does it.

    No.

    adding size value does it.

    Thanks again.

    tara

    esmi

    @esmi

    Forum Moderator

    Either something within the search form has a set width that is restricting the form’s minimum width or it’s something else within your CSS. Can you remind of your site’s url again, please?

    Moderator t-p

    @t-p

    hi esmi,

    1) here is: http://www.gurbani.org

    2) I was just curious as to what exactly the following piece of code does

    value=”<?php if(trim(wp_specialchars($s,1))!=”) echo trim(wp_specialchars($s,1));else echo ‘ ‘;?>”

    3) also I tried add the following piece of code brfore or after the above piece, but NO success (“Search Blog does not appear in the search box).

    value=”Search Blog” id=”s” onfocus=”if (this.value == ‘Search Blog’) {this.value = ”;}” onblur=”if (this.value == ”) {this.value = ‘Search Blog’;}”

    thanks esmi

    tara

    esmi

    @esmi

    Forum Moderator

    1.It is the width on input#s that’s affecting the searchform width. Try a width of 50px in:

    #s {
    -x-system-font:none;
    color:#AB99BC;
    font-family:Arial,Helvetica,sans-serif;
    font-size:12px;
    font-size-adjust:none;
    font-stretch:normal;
    font-style:normal;
    font-variant:normal;
    font-weight:normal;
    line-height:normal;
    padding:1px;
    width:140px;
    }

    then remember to do a hard refresh when viewing the updated page.

    2. It places the last term searched in the input box with any leading or trailing blank spaces removed.

    Moderator t-p

    @t-p

    Hi esmi,

    thanks a lot for your help and patient.

    I tried that solution

    Did not work – the search box size does not change with changing the width to even zero.

    tara

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Resolved] How to change the submit button from “Search” to “Go”’ is closed to new replies.
Skip to toolbar