• Resolved kocakserdar7

    (@kocakserdar7)


    Hi dear,

    I’m using Multilingual press plugin to connect each site (TR and EN) and I have a important issue. My theme developer tried to fix that issue but he couldn’t… He said ” it’s mostly related to the plugin. ”.

    Check the thread for more information please: https://themeforest.net/item/writing-blog-personal-blog/11547928/comments?page=22&filter=all#comment_20076643

    Regarding the issue,

    1- I create a category named ” SEO Library ” for each language (url: https://wplibrary.net/category/seo-library)
    2- I connect these categories via your plugin for Turkish and English.
    1- Then, I create a page that is called ”SEO ”. ( url: https://wplibrary.net/seo and https://wplibrary.net/tr/seo )
    2- I change template of this page as ” Blog page ” and select ”show SEO category posts only on this page ” (check the following image please.)
    3- Then, connect these pages with Multilingual Press plugin for Turkish and English.

    Ekran Resmi 2018 08 03 14 34 51

    Result and issue: Linkage (language switcher) on the footer redirects visitors from ” SEO page ” to the category page only. But hreflang on the source code looks correct.

    Example:
    go to: https://wplibrary.net/seo
    and click ” Türk?e ” on the footer.
    it will redirect you to the category page: https://wplibrary.net/category/seo-library

    But it should be redirected you to the Turkish page. Not category page.

    As I said before, hreflang looks correct on the SEO page.
    <link rel="alternate" hreflang="en-US" href="https://wplibrary.net/seo/"><link rel="alternate" hreflang="tr-TR" href="https://wplibrary.net/tr/seo/">

    Please bro help me!

    ——
    Additionally information:

    If I change template of the page as ” Default template ” (Not -Blog page-). The linkage on the footer is working correctly.

    Ekran_Resmi_2018_08_03_14_57_55

    For instance: https://wplibrary.net/contact-us (no problem for this page).

    I need your help. Could you please fix that issue?

    THANK YOU SO MUCH!
    Best regards!

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support dinamiko

    (@dinamiko)

    Hi kocakserdar7,

    We don′t know what this theme template (Blog Page) is doing under the hood, we can not check and see the code because it is a premium theme.

    As a workaround, MultilingualPress (MLP) provides a filter that allows you to change the value of the URLs (like menu items or language switcher) based on conditions, for example if the page is SEO you can do a search and replace in the URL.

    Here is a code snippet that you can add to your theme functions.php and use as a starting point, you need to adapt it:

    function filter_mlp_linked(
        $url,
        $target_site_id,
        $target_content_id,
        Mlp_Translation_Interface $translation
    ) {
    
        if (!is_page('seo')) {
            return $url;
        }
    
        if (!is_a($translation, 'Mlp_Translation_Interface')) {
            return $url;
        }
    
        $source_site_id = $translation->get_source_site_id();
        if (!$source_site_id) {
            return $url;
        }
    
        if (is_page('seo')) {
            str_replace(
                '/category/seo-library',
                '/tr/seo/',
                $url
            );
        }
    
        return $url;
    }
    add_filter( 'mlp_linked_element_link', 'filter_mlp_linked', 10, 4 );

    Thanks,
    Emili

    Thread Starter kocakserdar7

    (@kocakserdar7)

    Hello Emili,

    Thank you for your help, I really appreciate it ??

    But the code snippet is not working. How can I adapt it? I added it to functions.php, and then purged all cache.

    Best regards!

    • This reply was modified 6 years, 7 months ago by kocakserdar7.
    • This reply was modified 6 years, 7 months ago by Marius L. J.. Reason: Removed login offer

    @kocakserdar7 try to apply the code in mu-plugin.php

    Thread Starter kocakserdar7

    (@kocakserdar7)

    Hi @pentatonicfunk,

    There is no mu-plugin.php file but I tried to add this code into multilingual-press.php

    It is not working unfortunately.

    But thank you for your help!

    Plugin Support dinamiko

    (@dinamiko)

    Hi kocakserdar7,

    We can only provide fixes for bugs in the plugin that can be reproduced in isolation, so if you can provide us with the steps to reproduce the issue using a default WordPress theme and with MLP only activated, then we can create an issue and work on the fix.

    The code snippet we provided you is not a copy/paste solution, you (or you developer) can use it as a starting point, but it needs to be adapted based on your template logic.

    Another option you can try is using a Navigation Menu widget with a WordPress menu, to do so first create a WordPress menu and add MultilingualPress Language items (you need to check Languages in top right Screen options to see the Language items), then assign this menu to Navigation Menu widget.

    Thanks,
    Emili

    • This reply was modified 6 years, 7 months ago by dinamiko.
    • This reply was modified 6 years, 7 months ago by dinamiko.
    Thread Starter kocakserdar7

    (@kocakserdar7)

    Hi Emili,

    It is fixed by the theme developer. The issue was related to blog page query.

    Thank you for your helps ??
    Best regards!

    • This reply was modified 6 years, 7 months ago by kocakserdar7.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Important Issue!’ is closed to new replies.