Problem with the wordpress navxt plugin when using polylang

Hello, using the Polylang Wordpress plugin for translation, and the breadcrumbs navxt plugin for breadcrumbs, but I have a problem. My default site language is Russian. In this language, there is no problem with bread crumbs. But when I add a new language and select it, there is one problem. For example, I go to a page, it should look like this:

The name of the home page in this language that I choose> The title of the article (or entry).

But this it happens like this:

The name of the home page in Russian> Home page name in another language> Article title

How can I fix this?

P.S to display the name of the main page in the Breadcrumbs plugin, I use this code in functions.php:

add_filter('bcn_breadcrumb_title', function($title, $type, $id) {
    if ($type[0] === 'home') {
        $title = get_the_title(get_option('page_on_front'));
    }
    return $title;
}, 42, 3);
Author: Elman Huseynov, 2017-12-29

2 answers

Alternatively, you can use javascript (in the example below, we change it for Russian)

if(document.documentElement.lang == "ru-RU") {
    $('.home').children('span').text('Главная');
    var text = $('.home').attr('href');
    text += /ru/;
    $('.home').attr('href', text);
}
 0
Author: David Amerov, 2019-05-28 11:57:31

First, you need to make sure that you have a translation for the Site Title field in the Polylang - Strings translations settings.

Next, you need to edit the plugin file class.bcn_breadcrumb_trail.php

Find the do_home () function in it and use the Polylang functions in it: pll_current_language(), pll_default_language(), pll_home_url () change the formation of the item with the main page in breadcrumbs.

 0
Author: Dmytro Kochuk, 2020-07-30 11:57:40