WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Search Light] Compatibility with WPML (4 posts)

  1. hiulit
    Member
    Posted 2 years ago #

    Hello there!

    I've installed the 'Search Light' plugin and it doesn't work with WPML.

    Does anybody know to hack the code to make it work?
    I've tried contacting the coders but I didn't get any answer..

    I tried to do it myself, but I couldn't get to it.
    I know that WPML uses an ID to identify the translated posts and there is a php snippet to get the 'lang' code for each language.. that's all.

    Thanks folks!

  2. hiulit
    Member
    Posted 2 years ago #

    I think I just figured it out!!

    Go to "searchLight.php" on line 185:

    $sql_where = " WHERE " . $sql_where;

    and just add:

    $sql_where = " WHERE " . $sql_where . " AND ID IN (SELECT element_id FROM wp_icl_translations WHERE language_code = '$lang')";

    Of course you have to specify the $lang, for that, just use:

    $lang = ICL_LANGUAGE_CODE;

    before the query.

    This has to be done too on line 200

    It seems to be working for me! :)

  3. hiulit
    Member
    Posted 2 years ago #

    Now I'd like to integrate the translation function, like:

    _e('Search results', 'youtheme');

    But I can't figure it out.
    I've done something, but then the CSS crashes... weird.

  4. hiulit
    Member
    Posted 2 years ago #

    I've got it!

    For example:

    echo '<h1>'.$count.' '. __('results', 'your_theme') .'</h1>';

Topic Closed

This topic has been closed to new replies.

About this Topic