Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Question in context with qTranslate
This topic contains 4 replies, has 2 voices, and was last updated by slash77 11 years, 2 months ago.
- AuthorPosts
- June 7, 2013 at 9:03 am #394
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
TorstenJune 7, 2013 at 10:30 am #395Hi!
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!-
This reply was modified 11 years, 2 months ago by
Ernest Marcinko.
-
This reply was modified 11 years, 2 months ago by
Ernest Marcinko.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
June 7, 2013 at 12:08 pm #406Hallo,
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
TorstenAttachments:
You must be logged in to view attached files.June 8, 2013 at 5:52 am #419I 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.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
June 10, 2013 at 10:20 am #422Hello,
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 - AuthorPosts
You must be logged in to reply to this topic.