LiveSearch 1.2 Creative Commons License

posted mid-afternoon by Constantinos. Filed under Code, WP Plugin

This post was originally published in 2006
The tips and techniques explained may be outdated.

Ok. I’ve widgetized this plugin, and updated the headers of the plugin. Now you can just install it, and put it anywhere on your sidebar using the Widget plugin. In its options you can specify whether or not you want the searchbox to be encompassed in the default widget wrappers (disabled by default). Pretty straight forward.

The css still needs to be updated, but I don’t know if I’ll be getting to that anytime soon. Any upgrades/suggestions anyone might have are more than welcome.

Here is a quicklink to the zip archive. Original files are always linked from the main LiveSearch post.

16 Responses to “LiveSearch 1.2”

  1. 1. Comment by manuel
    on 29 May 2006 @ 12:03 pm

    first off let me thank you for your part of the work πŸ™‚

    livesearch seemed to be tricky, but your plugin was just install and voila. cheers! but i have one question tho’: i am trying to fiddle out how to apply a custom background image to the searchbox (i dont like it that it looks good in safari but awful on IE.

    any clue buddy?

  2. 2. Comment by Constantinos
    on 29 May 2006 @ 1:08 pm

    [quote comment=”259″]but i have one question tho’: i am trying to fiddle out how to apply a custom background image to the searchbox (i dont like it that it looks good in safari but awful on IE.[/quote]

    Well, for this you’ll need some clever CSS. There’s no real formula you can apply here, just trial and error, depending on what it is you’re looking for exactly.

    The general idea for styling search boxes with background images is this: First use css to clear the borders of the search box completely. In other words, make it completely white, so you have a clean slate to work with. Next, you need to create 3 separate images: The left border, the right border, and the middle image (which is usually 1px wide, and repeats).

    From there, things get a little bit tricky. You’ll need two elements in addition to your searchbox. One element will have to be attached to the left side of the box, and the other to the right. the corresponding images are then set as background images for each box, with the appropriate positioning and repeating.

    The issue is cross-browser compatibility. There’s a lot of difference in the way various browsers render css spacing and positioning, which obviously causes problems, since you want your box to be consistent no matter what browser each visitor is using. Unfortunately I have no time right now as I’m drowining in the last few days of my thesis. If you’re willing to wait a couple of weeks though, I’d be more than happy to work at it with you and maybe come up with a solution that I could standardize, and maybe even throw in a plugin? πŸ™‚

  3. 3. Comment by manuel
    on 29 May 2006 @ 4:54 pm

    holy crap, thats a nice offer! πŸ™‚

    hope your thesis will be a blast for them! sure thing, i have plenty of time to wait. just had two days off and that why i had time to play around a lil.

    righto- i totally forgot that i could edit the border and background of the searchbox!
    the left middle right thing cant be such a biggie. i am sure this can be solved, even crossbrowser compiliant and good looking πŸ™‚

    plugin would rock as well, one for ordinary WP searchboxes, and one for your livesearch plugin.

    hope to hear from you and all goes well!

  4. 4. Comment by Dan Butcher
    on 12 Jun 2006 @ 5:42 am

    Love the live search plugin! Works exactly has I hoped. One question: the “arrow keys and enter” “close” text is really small, but I can’t figure out what in the css controls that. Any suggestions?

    Thanks,
    Dan

  5. 5. Comment by Dan Butcher
    on 12 Jun 2006 @ 5:53 am

    Figured it out–I’m using your plugin with K2, because the built-in live search doesn’t seem to work. There were styles coming from 2 stylesheets; once I changed the size of the LS small to 1em, it was fine.

    Dan

  6. 6. Comment by tomshiii
    on 25 Jun 2006 @ 5:19 am

    hi,

    thanks for this great plugin!!!

    but i can’t get it to work, it’s always no results, even when directly calling the xmlhttpreq url with a ‘s=searchstring’ parameter…
    trying the same on your site, it works…

    it seems like there is an empty $posts variable in livesearch.php (yes there are posts :-), and i don’t know wordpress too well to find out what’s wrong here and where the DB search is actually called…

    the ‘regular’ search when pressing ‘more results’ is working though.

    i’m running on wordpress 2.0.3 with livesearch as plugin…

    any help will be highly appreciated
    πŸ™‚
    cheers, thomas, vienna, austria.

  7. 7. Comment by tomshiii
    on 25 Jun 2006 @ 5:21 am

    [quote post=”46″]iΓƒΒ’Γ’β€šΒ¬Γ’β€žΒ’m running on wordpress 2.0.3 with livesearch as pluginΓƒΒ’Γ’β€šΒ¬Γ‚Β¦[/quote]

    of course it’s “on wordpress 2.0.3 with livesearch as a widget

  8. 8. Comment by Constantinos
    on 25 Jun 2006 @ 2:08 pm

    [quote comment=”280″]hi,
    any help will be highly appreciated
    πŸ™‚
    cheers, thomas, vienna, austria.[/quote]

    If I had a link to your site it would help greatly!

    If you don’t want to post it here, feel free to email it to me and I’ll take a look.

  9. 9. Comment by tomshiii
    on 26 Jun 2006 @ 1:37 am

    Constantinos,

    thanks for your quick reply, site url is blog.piribauer.com

    cheers, thomas.

  10. 10. Comment by Constantinos
    on 26 Jun 2006 @ 9:18 am

    Thomas,

    I’m assuming you’ve looked at the livesearch.php file, since you talked about the empty $post variable.

    That variable gets set in the
    require('../../../wp-blog-header.php');
    command, on the first line of code.

    That same file should be included by your index.php file. Since the ‘More results’ link works, please open index.php in your root public folder and verify that it contains the line:
    require('./wp-blog-header.php');
    If it does, then I’m afraid we’ll have to start digging a bit deeper in the wordpress gut to find the problem πŸ™‚

  11. 11. Comment by tomshiii
    on 26 Jun 2006 @ 1:25 pm

    yes, it’s all in there….

    i also installed the k2 theme containing livesearch as well and it won’t work either….

    thanks for your effort,
    cheers, thomas.

  12. 12. Comment by tomshiii
    on 28 Jun 2006 @ 2:52 am

    Constantinos ,

    i found the problem, it was a wrong custom permalink structure in the form /%category%/%postname%/

    digged really deep into classes.php where wp() is called and found a malformed query string based on that structure

    changing the permalinks to %postname% solved the problem….

    thanks for your help and effort!
    cheers, thomas.

  13. 13. Comment by Constantinos
    on 28 Jun 2006 @ 4:01 am

    Sweet!
    I must admit I did not think of that.. πŸ™‚ Good thing you figured it out, now we know that can be a problem πŸ™‚ Thanks!

  14. 14. Comment by Ash Haque
    on 15 Aug 2006 @ 3:24 am

    Nice find tomshiii, I was having the same problem for quite some time =\

  15. 15. Comment by Chris
    on 22 Sep 2006 @ 2:21 pm

    Hi Constantinos,

    Your LiveSearch plugin is very cool and it works like a charm!
    I am developing a new theme for my blog and I have tried out a few other approaches to LiveSearch, but yours is superior.

    I did make a couple of changes to ‘livesearch.php’:

    -I moved line 13 inside the ‘if ($posts)’ loop, so the link to ‘More Results…’ is only shown, if there are results.
    -The link to ‘/index.php’ in line 13 assumes WordPress to be located in the website root folder – I changed the link to ‘<?php bloginfo(‘url’); ?>/index.php’ to make the link work if this is not the case.

    Thanks again

    /chris

  16. 16. Comment by Max Weir
    on 5 Oct 2008 @ 11:10 pm

    Hey there,

    I’ve added the live search plugin to my blog but it doesnt work at all. I have the standard setup with the header and footer call, the sidebar.php uses the template call like you mentioned.
    I have another plugin running called search everything, could this effect it at all?

    Any help would be appreciated,

    Thanks.

Leave a Reply