• Hi Yannick. Ran your update and the English and Francais links are missing to allow the user to switch over to the different language?

    Site is http://gbgh.on.ca. Before the update, there was a link for Francais in the top right-corner to allow the user to visit the french version of this page. Same for all of the other pages.

    Now they are all missing? Thoughts?

    This is the code I have in my header:

    <?php
    // News
    if (is_archive()) {
      $newsURL = str_replace("/category/", "/fr/category/", "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]");
       echo "<a href='$newsURL'>Français</a>";
    
    // Search results
    //} elseif (is_search()) {
    //	$searchURL = str_replace("/?", "/fr/?", "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]");
    //	echo "<a href='$searchURL'>Français</a>";
    
    // Otherwise:
    } else {
    // Bilingual Linker for French template
    if ( function_exists( 'OutputBilingualLink' ) ) :
       echo OutputBilingualLink( $post->ID, 'Français', '', '');
    endif;
    }
    ?>

    https://ww.wp.xz.cn/plugins/bilingual-linker/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Yannick Lefebvre

    (@jackdewey)

    You should be using the newer the_bilingual_link function instead of the old OutputBilingualLink function. You can call it without any argument (the_bilingual_link()), then specify the language name to be displayed in the configuration panel under the Settings section in the admin.

    Bilingual Linker, with the new function, can also be used to map categories between two different sites. You can specify the link for the category page in the other language for each category when you edit them.

    Let me know if these explanations make sense.

    Thread Starter mdininio

    (@mdininio)

    Thanks for this Yannick. What would I be replacing in my code to use the new function call? Can you please use my code above with the new call. That would be great. Thanks!

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    You would replace all of the code above with:

    <?php
    the_bilingual_link();
    ?>

    Then make sure you assign translation links to each category on each of the sites.

    Thread Starter mdininio

    (@mdininio)

    I have assigned translation links to every page and post on both sites (EN and FR). Is what you mean by ‘each category’?

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    No, for translation links to work properly on archive pages, you need to go to the Posts | Categories menu, then edit each category and assign the Language Link for each of them.

    Thread Starter mdininio

    (@mdininio)

    I use the posts section for my website’s news and I use the pages section for all of the pages. Not sure why this has completely changed. Is there a way for me to revert back to the previous version that was working for my entire site?

    Thread Starter mdininio

    (@mdininio)

    OK, I have it working for most of my site now which awesome. I had the wrong FR link in there so sorry about that. The only thing it won’t display is on the homepage. The ‘Francais’ link is there but it’s pointing to ww.wp.xz.cn instead of the other french homepage and vice versa. Thoughts?

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    Yes, go to the configuration setting section for Bilingual Linker and assign the default translation URL. This will be the address used for the home page or for any posts / page that does not have a translation URL attached to it.

    Thread Starter mdininio

    (@mdininio)

    That worked! OK, last one. My search page isn’t directing properly. This is neither a post or page. Its a separate template I created based on the homepage template and calls the same header page. It looks to be using the same settings as the homepage. Is there an ‘if’ statement I could use in conjunction with the ‘the_bilingual_link()’ call that will let me do a string replace like I had in my previous code.

    http://gbgh.on.ca/search/ should go to http://gbgh.on.ca/fr/chercher/ but there is no actual page to add the french link in WordPress. Its a set page in the theme.

    I may have to create its own header page and hard code it in. Thoughts?

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    How is that template being called? Normally, /search will not go anywhere unless you have a page or post defined. Are you sure this is not the case?

    Thread Starter mdininio

    (@mdininio)

    Sorry Yannick, my bad. There is indeed a page for each of these I had created before. Need coffee. ITS ALL WORKING NOW!

    Thanks so much for working through and helping me out with this. This plug-in is a life saver for anyone with a multi-lingual site.

    Keep up the great work! 🙂

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    Thanks for the good words. Glad it’s working now. Please considering rating the plugin if you have not already and supporting its development.

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Bilingual Links missing’ is closed to new replies.