Took me a few hour of reading and playing around (I dont know PHP) but I finally replaced the default
searchbox in the header with a
google searchbox
This is what i did:
1. access your theme folder using an FTP client, open the
functions folder there.
2.find the file
bfa_header_config.php and transfer a copy of it to my computer then renamed the original on the site server to
oldbfa_header_config.php
3. opened the copy on my computer with a text editor and scroll to line 284 (// search box)
This is what displays the search box when its turned on in the theme option screen.
PHP Code:
if ( $bfa_ata['show_search_box'] == "Yes" ) {
echo '<td valign="bottom" class="search-box" align="right"><div class="searchbox">
<form method="get" class="searchform" action="'; bloginfo( 'url' ); echo '/">
<div class="searchbox-form">' .
// Check for WP 2.2 which doesn't know get_search_query
(function_exists('get_search_query') ? '
<input type="text" class="text inputblur" onfocus="this.value=\''.
(get_search_query() ? get_search_query() : '' ).'\'"
value="' . (get_search_query() ? get_search_query() : $bfa_ata['searchbox_text'] ) .
'" onblur="this.value=\''.(get_search_query() ? get_search_query() : $bfa_ata['searchbox_text'] ).
'\'" name="s" />' :
'<input type="text" class="text inputblur" name="s" />') .
'</div>
</form>
</div>
</td>';
}
echo '</tr></table>';
deleted this:
PHP Code:
'; bloginfo( 'url' ); echo '/
in line 287;
PHP Code:
<form method="get" class="searchform" action="'; bloginfo( 'url' ); echo '/">
deleted all of this:
PHP Code:
// Check for WP 2.2 which doesn't know get_search_query
(function_exists('get_search_query') ? '
<input type="text" class="text inputblur" onfocus="this.value=\''.
(get_search_query() ? get_search_query() : '' ).'\'"
value="' . (get_search_query() ? get_search_query() : $bfa_ata['searchbox_text'] ) .
'" onblur="this.value=\''.(get_search_query() ? get_search_query() : $bfa_ata['searchbox_text'] ).
'\'" name="s" />' :
'<input type="text" class="text inputblur" name="s" />') .
deleted the " '." at the end of this line
PHP Code:
<div class="searchbox-form">' .
(line 288)
and the ' at the start of this line
(line 297)
code should now look like this:
PHP Code:
if ( $bfa_ata['show_search_box'] == "Yes" ) {
echo '<td valign="bottom" class="search-box" align="right"><div class="searchbox">
<form method="get" class="searchform" action="">
<div class="searchbox-form">
</div>
</form>
</div>
</td>';
removed
from <form method="get" class="searchform" action="">
at this point you can insert your code for the google searchbox on the line after
PHP Code:
<div class="searchbox-form">
and before
you might have to play around with it a bit to get it to work as I don't have the code for all the google search box.
for mine, I changed the action="" in the form tag to match the 'action=' string in my google code;
"http://www.google.ca/cse" id="cse-search-box" target="_blank"
and move this
HTML Code:
<script type="text/javascript" src="http://www.google.ca/cse/brand?form=cse-search-box&lang=en"></script>
to below the closing form tag </form>
4. save then upload file to t
hemefolder/functions/
5.the result is
here
6. will also have to adjust the style settings in the theme option header section scroll down to search box and adjust the width, bottom margin, and right margin position where you want it.
hopes this help anyone who is trying to do the same
PS:make notes of all changes and keep a copy of the modified file so you can make the needed changes again if and when the theme is updated
it would have been nice if this was kept in the searchform.php so you could simply replace/mod that file.