Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Dennis Ploetner

    (@realloc)

    I cannot access your website at all. Please, provide a working link.

    Thread Starter most1879

    (@most1879)

    Hi Dennis, it is accessible, you just have to click on “accept the risk”, because we don’t have ssl on the website yet, it is just a stage website, if you try to use Mozilla Firefox, it will work. Please try again.

    Thread Starter most1879

    (@most1879)

    Hi Dennis,

    I have changed the domain now, it is on this: https://diamant-polymer.de/

    now, the Product categories are not linking to their translation, but they just get random linking, sometimes to news.
    for example:
    https://diamant-polymer.de/produkte/dichtol/

    should link to: https://diamant-polymer.de/en/products/dichtol/

    instead it is linking to: https://diamant-polymer.de/en/produkte/dichtol/

    Although in the permalink for the english website I have the Kategorie-Basis Produkte set to: products
    and in the German website it is set to: produkte

    Plugin Author Dennis Ploetner

    (@realloc)

    Please, go first into the permalinks section of the sites. This will automatically refresh them. You don’t need to click on anything for that…

    Thread Starter most1879

    (@most1879)

    I have done that probably many times, and i did it again now as you requested, there is no change.

    Goran

    (@goran63)

    I’ve had the same problem. This PHP snippet resolved it for me. Change language data for your case.

    /**
     * @param string $postlink
     * @param string $language
     * @return string
     */
    function my_msls_options_get_permalink( $url, $language ) {
        if ( 'sr_RS' == $language ) {
            $url = str_replace( '/product/', '/proizvod/', $url );
    		$url = str_replace( '/products/', '/proizvodi/', $url );
        }
    	if ( 'en_US' == $language ) {
            $url = str_replace( '/proizvod/', '/product/', $url );
    		$url = str_replace( '/proizvodi/', '/products/', $url );
        }
        return $url;
    }
    add_filter( 'msls_options_get_permalink', 'my_msls_options_get_permalink', 10, 2 );

    Hope it helps.
    Best regards,
    Goran

    • This reply was modified 7 months ago by Goran.
    Plugin Author Dennis Ploetner

    (@realloc)

    Thanks @goran63!

    You can, whenever you have to deal with translated slugs, override it by using the filter “msls_options_get_permalink”. There is also some example code in this page: https://msls.co/developer-docs/hook-reference/

    Thread Starter most1879

    (@most1879)

    Thanks @realloc , thanks @goran63
    it worked only for the products category, for the normal wordpress categories like news and presse-releases, it didn’t work, as the language switcher doesn’t even get the link to the other category.

    for example these links:
    https://diamant-polymer.de/aktuelles/
    https://diamant-polymer.de/presse/

    they should link to:
    https://diamant-polymer.de/en/news/
    https://diamant-polymer.de/en/press-releases/

    But instead, they both link to the homepage of the other language.

    This is the code i used now:
    function my_msls_options_get_permalink( $url, $language ) {
    if ( ‘de_DE_formal’ == $language ) {
    $url = str_replace( ‘/products/’, ‘/produkte/’, $url );
    $url = str_replace( ‘/news/’, ‘/aktuelles/’, $url );
    $url = str_replace( ‘/press-releases/’, ‘/presse/’, $url );
    }
    if ( ‘en_US’ == $language ) {
    $url = str_replace( ‘/produkte/’, ‘/products/’, $url );
    $url = str_replace( ‘/aktuelles/’, ‘/news/’, $url );
    $url = str_replace( ‘/presse/’, ‘/press-releases/’, $url );
    }
    return $url;
    }
    add_filter( ‘msls_options_get_permalink’, ‘my_msls_options_get_permalink’, 10, 2 );

    Plugin Author Dennis Ploetner

    (@realloc)

    Your code works for me also for the connection between presse and presse-release.

    BTW there should be no problem if those categories are connected. Let’s take a simple example (there is no result but it renders the idea):

    https://msls.co/category/general/ links to https://msls.co/de/category/allgemein/ and vice versa


    Thread Starter most1879

    (@most1879)

    Hi Dennis,

    They are connected: (see screenshot)

    but in the frontend, if you hover on the language switcher, you will see that the link goes to the homepage, it acts like they are not linked: ( see screenshot)

    Plugin Author Dennis Ploetner

    (@realloc)

    But they look also wiered because they also have no slug. A category has normally category as a slug, like tag for the tags. They seem pages that are not connected.

    Thread Starter most1879

    (@most1879)

    no, the slug is removed with options from Yoast SEO plugin.

    Thread Starter most1879

    (@most1879)

    I don’t know why yet, but it seems that there is a conflict between this plugin and WooCommerce on our website, which affect the regular WordPress categories, if i disable Woocommerce on these pages, the language switcher work fine, so any idea how i can solve this without disabling Woocommerce?

    Plugin Author Dennis Ploetner

    (@realloc)

    Thank you for all the valuable input. I’m currently working on some fixes. You can find more information at https://github.com/lloc/Multisite-Language-Switcher/

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Not working with wordpress category pages’ is closed to new replies.