Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Plugins & Atahualpa (http://forum.bytesforall.com/forumdisplay.php?f=16)
-   -   Instant Search Suggestions, plugin problem (http://forum.bytesforall.com/showthread.php?t=18727)

rendesr Oct 22, 2012 04:44 AM

Instant Search Suggestions, plugin problem
 
Hello Gang,

I have purchased the following plugin http://bit.ly/X0b52x

It enhances the standard search functionality of the search box, and suggests searches etc.

It doesn't work with the Atahualpa 3.7.9 theme unfortunately.

I contacted the plugin developer, who looked into the problem and came back to me saying:

Quote:

You have onfocus="this.value=''" on your search input. So when a user selects a suggestion the text input is given focus again and it clears the selection instantly. With this removed it seems to work as you would expect. You should be able to edit this in your theme. Ideally it will be an file called searchform.php: http://codex.wordpress.org/Function_...et_search_form

The placeholder text will stay with your javascript removed. You need to have a look at the HTML5 placeholder attribute instead and if you want it to work across all browsers you can look at grabbing a polyfill (https://github.com/ginader/HTML5-placeholder-polyfill). My default WordPress search form looks like this: <snip>

I cannot really follow the code you sent me - its a bit of a mess. All you need to do is remove the onfocus and onblur events and replace it with the placeholder example above.
The code I sent to him was this:
Code:

<div class="searchbox-form">' .
// Since 3.6.8: Removed check whether get_search_query() exists and added esc_js
 * * * * '<input type="text" class="text inputblur" onfocus="this.value=\'' .
* * * * ( get_search_query() ? esc_js(get_search_query()) : '' ) . '\'"
* * * * value="' . (get_search_query() ? esc_js(get_search_query()) : esc_attr($bfa_ata['searchbox_text']) ) .
* * * * '" onblur="this.value=\'' . ( get_search_query() ? esc_js(get_search_query()) :
        esc_attr($bfa_ata['searchbox_text']) ) . '\'" name="s" />' .
'</div>

If I'm honest, I kind of understand what the problem is, but have no idea how to impliment the solution he suggested.

Any help or pointers greatly appreciated.

Steve

juggledad Oct 22, 2012 05:37 AM

try this, edit bfa_header_config.php and change the code
HTML Code:

                                        <div class="searchbox-form">' .
                                        // Since 3.6.8: Removed check whether get_search_query() exists and added esc_js
                                                '<input type="text" class="text inputblur" onfocus="this.value=\'' .
                                                ( get_search_query() ? esc_js(get_search_query()) : '' ) . '\'"

                                                value="' . ( get_search_query() ? esc_js(get_search_query()) : esc_attr($bfa_ata['searchbox_text']) ) .
                                                '" onblur="this.value=\'' . ( get_search_query() ? esc_js(get_search_query()) :
                                                esc_attr($bfa_ata['searchbox_text']) ) . '\'"
name="s" />
' .
                                        '</div>

to
HTML Code:

                                        <div class="searchbox-form">' .
                                        // Since 3.6.8: Removed check whether get_search_query() exists and added esc_js
                                                '<input type="text" class="text inputblur" value="' . ( get_search_query() ? esc_js(get_search_query()) : esc_attr($bfa_ata['searchbox_text']) ) .
                                                '"
onblur="this.value=\'' . ( get_search_query() ? esc_js(get_search_query()) :
                                                esc_attr($bfa_ata['searchbox_text']) ) . '\'"
name="s" />
' .
                                        '</div>


rendesr Oct 22, 2012 06:31 AM

Thanks JuggleDad - Much appreciated!

That gets part of the problem resolved, the plugin seems to work now, but the 'search this site' text that is in the search box by default, doesn't get removed when the user clicks in the box.

This plugin works with a new install of WordPress, and the plugin support team said I needed to be using HTML 5 just like the vanilla WordPress installation.. You can demo it here: http://wp.scott.ee/

Is this something that can easily be amended in the Atahualpa theme?

juggledad Oct 22, 2012 07:07 AM

why not remove the text? Look in the header options.

rendesr Oct 22, 2012 07:13 AM

Yeah that's what I will do, but from a UX experience I wanted to keep some indication that the box at the top is the search box.

Many thanks for your help, much appreciated :)

juggledad Oct 22, 2012 07:36 AM

since according to w3schools.com - the placeholder atribute does not work with IE, why would you want to use it?
if you want you can see what happens if you change teh code.


All times are GMT -6. The time now is 06:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.