Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #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:

    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,
    Monique

    #879987

    Hey 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,
    Ismael

    #880222

    Hi 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,
    Monique

    #881047

    Hi,

    Please copy the code directly from this forum, not from your email.

    Best regards,
    Ismael

    #881100

    Hi 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 7 years, 1 month ago by Monique.
    #881807

    Hi,

    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,
    Ismael

    #916002

    Hi,

    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,
    Monique

    #916076

    Hi Monique,

    Ok, closing this one.

    Glad we got it working for you! :)

    If you need further assistance please let us know.

    Best regards,
    Victoria

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Translation issues on multi language websites with breadcrumb & single post titl’ is closed to new replies.