This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Question in context with qTranslate

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #394
    slash77slash77
    Participant

    Hello,
    me again, this time for an other site (if it works I will buy your plugin again, it is working perfectly).

    I have a little problem with ajax search pro in context with qTranslate. I use qTranslate in Pre-Path Mode – default, puts /en/ in front of URL like:

    http://www.kitzig.com/en/suche

    But if you search for example: “Munich” only the titles are in English, not the description and the URLs don´t have any language code, so the results are in the default language – german.

    In my functions.php I added the folling filter:

    add_filter( ‘post_type_link’, ‘qtrans_convertURL’ );

    because I had problems with portfolios url and that solved the problem. I tried in ajax-search-pro/includes/shordcodes.php to change

    homeurl: ’<?php echo home_url(’/’); ?>’,

    into

    homeurl: ’<?php echo qtrans_convertURL($_SERVER[“REQUEST_URI”]); ?>’,

    but that is not the right place. Do you know if this would solve the problem and perhaps how the correct function or add_filter must look like, or did I have not the correct values in the backend of ajax search pro?

    If is more complicated, perhaps you can fix it, not for free of course, just give an estimate for it.

    Thank you very much
    Torsten

    #395
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!
    So I guess you only need to add the proper filter for the link and the description. The title is working, because it’s using the get_the_title($pageposts[$k]->id); function, and I guess qtranslate already applies a filter on the get_the_title funtion.
    What you need, is to find the proper qtranslate filter for the content and the url. What I have found out from the qtranslate source code, is this:

    • qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage -> content filter
    • qtrans_convertURL -> url filter

    Okay, now all you need to do is add these filters to the search source code:

    • Open up the ajax-search-pro/search.php
    • go to line 269 and make a new line
    • add the following lines:
      `apply_filters(‘qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage’, $_content);
      apply_filters(‘qtrans_convertURL’, $pageposts[$k]->link);`

    If the permalink is still not good, then try to modify the second line to: apply_filters(‘the_permalink’, $pageposts[$k]->link);
    Let me know how it goes!

    #406
    slash77slash77
    Participant

    Hallo,
    no don´t work, there is no variation, or I have made something wrong.

    The best way would be to know which language is the current one and only search in the titles and description of the current language and shows only urls of the current one.

    But I think it is a very special problem and beyond the normal support. If you have time and disposed perhaps you can make me an offer for fix it, because my knowledge about PHP is very low.

    Thank you
    Torsten

    #419
    Ernest MarcinkoErnest Marcinko
    Keymaster

    I thinks that is not possible to achieve, since qtranslate strings are stored at the same place as the normal strings.

    Unfortunately I don’t have time now for paid jobs, but I will take a look at this as soon as I can.

    #422
    slash77slash77
    Participant

    Hello,
    thank you for explaining the complex of problems. Perhaps you find an other approach or a simple solution, then please leave me a notice. I will have a look on your forum and the comments of themeforest.net.
    Thank you very much
    Kind regards
    Torsten

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.