Forums › Forums › Search & Filter Pro › Issue: Form redirection to another language form + Multisite doubt
Tagged: issue, issues, language, multisite, polylang, redirection, shortcode, translation
- This topic has 11 replies, 4 voices, and was last updated 7 years, 6 months ago by Trevor.
-
Anonymous(Private) April 19, 2017 at 12:41 pm #103758
Hello,
Issue:
I have a client site that has two languages with polylang and a form in each language (this, i do not know if it is correct) that should show the results of a taxonomy in a custom post type. In Spanish language everything works fine, but when going to the other language and filtering the content by title, it ends up showing both the form and the content in Spanish.Details that may help:
site linkI have a custom post type called activities and a hierarchical taxonomy called activity_type, common to both languages but with different posts in each.
The two forms are configured by shortcode and I have three templates, one called results.php (in the local folder search-filter) that gives the format of the results, and other two (activities.php and results-search.php) I practically have the same code and I really do not know if they are needed (at least one of them) because results-search.php is the redirect of activities.php and I am using ajax.In activities.php I have a wp_query that sets the language of the query in your $ args but does not solve the problem.
The shortcode is conditionally charged according to the language of the site:
<? Php if (get_bloginfo ('language') == 'es-ES'):?> <H3> Buscador </ h3> <? Php echo do_shortcode ('[searchandfilter id = "928"]');?> <? Php else:?> <H3> Cercador </ h3> <? Php echo do_shortcode ('[searchandfilter id = "930"]');?> <? Php endif?>
I do not know if this influences the error and it is not the right way to work, but I do not know what to do.
One last question is whether this plugin will work in multisite.
Many thanks and congratulations for this plugin.
Regards.
Trevor(Private) April 19, 2017 at 12:53 pm #103761That code is wrong, it should be:
<?php if ( get_bloginfo('language') == 'es-ES' ):?> <h3>Buscador</h3> <?php echo do_shortcode('[searchandfilter id = "928"]'); else:?> <h3>Cercador</h3> <?php echo do_shortcode('[searchandfilter id = "930"]'); endif?>
I am not sure if would work; I simply corrected the coding errors.
Trevor(Private) April 20, 2017 at 9:07 am #103974There are two forms there, 928 and 930. Which one is Spanish and Which one is Catalan
Did you try echoing the language code, like this:
<?php $blog_language = get_bloginfo('language'); if ( $blog_language == 'es-ES' ):?> <h3>Buscador (language: <?php echo $blog_language;?>)</h3> <?php echo do_shortcode('[searchandfilter id = "928"]'); else:?> <h3>Cercador (language: <?php echo $blog_language;?>)</h3> <?php echo do_shortcode('[searchandfilter id = "930"]'); endif?>
Anonymous(Private) April 20, 2017 at 12:33 pm #104010yes, but it doesn´t fix the problem altough i fixed it casualy.
The solution was to deactivate ajax of the form in Catalan and it works
The problem must have been ajax and some conflict that recharges erroneously.I have seen that if I delete the conditional that loads the shortcodes according to language, I can see the translated form, but ajax does not work in that case, however, if if I keep the conditional with the shortcodes and disable ajax in the Catalan form, ajax works (and I can also see the form in Catalan)
What is the best way to work with a two-language form and shortcodes?
Did not answer me but, will this work in multisite?
Thank you
Regards
Ross Moderator(Private) April 21, 2017 at 9:37 am #104173Hi there
In general you should not need a conditional to display the correct form for each language,
S&F will detect the current language and show the correct form if there is a translation.
Although, you mention a strange ajax issue…
Anyway, regarding the mix of languages, sometimes issues occur when taxonomies/terms are not translated.
Did you create translations for your taxonomies and your terms in Polylang?
If not, create translation for all, then rebuild S&F cache, and test again.
Let me know how you get on.
Best
Anonymous(Private) April 21, 2017 at 12:16 pm #104192Thank you for the reply
I have removed the language conditional in both templates and only show the shortcode of the Spanish language and displays the form that corresponds to each language. 🙂Regarding taxonomies, what I have translated are the terms.
I have a taxonomy called activity_type and within 3 terms (courses, seminars and days), these terms if they have a translation.Polylang offers manual translation of the terms, and for taxonomy, I know it has to be activated in the polylang settings, but I only see one taxonomy common to both languages (if I change a parameter in the taxonomy in Spanish, it also changes in Catalan)
Anonymous(Private) April 22, 2017 at 12:20 am #104268Hi, I have a similar problem, the form works fine in English but I don’t get any results in French…
http://www.intheloup.la -
AuthorPosts