Tagged: multi-language, polylang, Single Portfolio, single post, translation
-
AuthorPosts
-
November 16, 2017 at 5:30 pm #877620
Hi,
On several multilanguage websites we have issues with the translation of the breadcrumbs and post titles. We use Polylang plugin for Multilanguage because we believe it is more user friendly for the people who maintain the content of their websites than WPML. One client specifically asked for “another plugin than WPML because it is a mess”. However, we kept on struggling to get the breadcrumbs correct.
It took a while for me to find out what is going on and that the problem for this website is the same for all multilanguage websites. The problem of the breadcrumb seems to occur with single portfolio and single posts when you switch from one language to another. Also the page title for single posts is not translated properly.
You can see several examples:
- Translators International
Portfolio pages: https://translators.nl/diensten/ and https://translators.nl/specialisaties/. See the submenu pages which are single portfolio. Then switch languages and pay attention to the breadcrumb. - Annemarie van der Heijden (This is the development site. The development site has the same installation/setting as the live site apart from the breadcrumb: on the live site we’ve hidden the breadcrumbs until the issue is solved.)
Portfolio page: http://u18747p13970.web0115.zxcs.nl/boeken/. Click on a book to enter a single portfolio, switch language and pay attention to the breadcrumb.
Single blog/news item in English shows Dutch page title “Berichten” instead of English page title “news”. See example. - De Starterwebsite
Portfolio pages: http://de-starterwebsite.nl/hoe-werkt-het/themes/ and http://de-starterwebsite.nl/mijn-werk/. Click an item to enter single portfolio, switch language and note the breadcrumb.
I contacted Polylang support and it seems that there is a compatibility issue between Enfold en Polylang. Their reply is:
“We digged into the Enfold code and we found that they created a compatibility with WPML (they wrote about 700 lines of code to handle that). Even with this integration the page title in the breadcrumb is the same for all the languages (but the link is in the correct language).
In fact, their integration target only WPML as they use some WPML internal functions. Polylang is compatible with the WPML API but not with WPML internal functions. This is probably why some things such as the breadcrumb and the page title don’t work out of the box.
Did you contact the Enfold support about these issues? Maybe they could help as they already integrated WPML. If they could point you to the part of the code which is necessary to make the breadcrumb and the page title work with WPML, maybe we could adapt it to Polylang.”So my request to you is if you can help to submit the necessary code which can be integrated in Polylang to help solving these issues?
Thanks in advance & best regards,
MoniqueNovember 22, 2017 at 3:24 am #879987Hey Monique,
Thank you for using Enfold.
The theme translates the breadcrumb correctly. Look at the “Services” page for example.
Nederlands: U bevindt zich hier:Home/Diensten English: You are here:Home/Services Francais: Vous êtes ici :Accueil/Services Deutsch: Sie befinden sich hier:Startseite/Dienstleistungen
However, the theme also filters the portfolio breadcrumb. It displays the previous page (Dienstleistungen) where the portfolio items are placed instead of the portfolio category. You can add the following filter to disable the said filter.
// remove avia_portfolio session function avia_change_breadcrumb($trail) { if(is_singular('portfolio')) { global $post; $home = $trail[0]; $last = array_pop($trail); $terms = get_the_terms($post->ID, 'portfolio_entries'); $ancestors = get_ancestors( $terms[0]->term_id, 'portfolio_entries', 'taxonomy' ); $parent = get_term( $ancestors[0], 'portfolio_entries' ); unset($trail); $trail[0] = $home; if(!empty($parent)) { $link = '<a href="'.get_term_link($parent->term_id, $parent->taxonomy).'">'.ucfirst($parent->name).'</a>'; $link = preg_replace('!rel=".+?"|rel=\'.+?\'|!',"", $link); $link = str_replace('<a ', '<a rel="v:url" property="v:title" ', $link); $trail[1] = '<span typeof="v:Breadcrumb">'.$link.'</span>'; } $trail['trail_end'] = $last; } return $trail; } add_action('after_setup_theme','avia_remove_portfolio_breadcrumb'); function avia_remove_portfolio_breadcrumb(){ remove_filter('avia_breadcrumbs_trail','avia_modify_breadcrumb'); add_filter('avia_breadcrumbs_trail', 'avia_change_breadcrumb', 100, 1); }
Best regards,
IsmaelNovember 22, 2017 at 12:51 pm #880222Hi Ismael,
Thanks for your reply.
When I use a.m. code, all single portfolio pages turn blank (or grey in this case).
Please advise.
Regards,
MoniqueNovember 24, 2017 at 5:35 am #881047Hi,
Please copy the code directly from this forum, not from your email.
Best regards,
IsmaelNovember 24, 2017 at 10:24 am #881100Hi Ismael,
That is what I did. I never copy from the email.
I’ll try again and let you know.
Best regards,
Monique- This reply was modified 6 years, 12 months ago by Monique.
November 26, 2017 at 12:29 am #881807Hi,
Alright. The filter didn’t return any errors when I tested it on my installation. Please post the login details in the private field if it’s still not working.
Best regards,
IsmaelFebruary 22, 2018 at 12:37 pm #916002Hi,
This topic was too confusing as it concerned multiple websites. The issues have been solved through other threads. Please flag this one as solved.
Thanks for your help!
Regards,
MoniqueFebruary 22, 2018 at 2:26 pm #916076Hi Monique,
Ok, closing this one.
Glad we got it working for you! :)
If you need further assistance please let us know.
Best regards,
Victoria - Translators International
-
AuthorPosts
- The topic ‘Translation issues on multi language websites with breadcrumb & single post titl’ is closed to new replies.