WordPress.org

Ready to get started?Download WordPress

Forums

SearchAutocomplete
[resolved] Highlight matching string (6 posts)

  1. sepehr125
    Member
    Posted 1 year ago #

    Thanks for a very well-written plugin. I know this may be stretching it, but I'm wondering how one might go about adding some CSS to the part of the result that matches the input. Any insights would be appreciated.

    Thank you.

    http://wordpress.org/extend/plugins/search-autocomplete/

  2. trewknowledge
    Member
    Posted 1 year ago #

    That would be awesome!

  3. gizmomol
    Member
    Posted 1 year ago #

    I modified search-autocomplete.js to include a _renderItem function that highlights the matched term. The modified function is on pastbin at http://pastebin.com/XzLbUrW4

    The plugin uses the "min" version of this function so you would need to change the searchautocomplete.php program to enqueue your modified version.

  4. hereswhatidid
    Member
    Plugin Author

    Posted 1 year ago #

    Very cool addon. I'll include this in the next release with a custom class name.

  5. hereswhatidid
    Member
    Plugin Author

    Posted 1 year ago #

    This has been added to the latest release (2.0.4). Matched strings are now surrounded with:

    <span class="sa-found-text"></span>

    So you can style that directly in your theme's CSS to control how it looks.

  6. hereswhatidid
    Member
    Plugin Author

    Posted 1 year ago #

    Marking this as resolved due to inactivity.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.