Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Here to answer my own question, I used an answer from one of the creator’s discussions with another fellow that can be found here, which could have saved me a lot of troublem with all those categories that I had to manually index.

    But, nevertheless, this is what I ended up with.

    If you want to switch header/footer/sidebar or other elements between 2 languages, where you have the files header.php for your default language (let’s say English) and header-fr.php for your default language (let’s say French), use:

    <?php
    $currentlang = get_bloginfo('language');
    if($currentlang=="en-GB"): get_header();
    else: get_header('fr');
    endif;
    ?>

    If you want to switch header/footer/sidebar or other elements between 3 or more languages, where you have the files header.php for your default language (let’s say English) and header-fr.php for your default language (let’s say French) and header-de.php for German/Deutsch, use:

    <?php
     $currentlang = get_bloginfo('language');
     if($currentlang=="en-GB"): get_header();
     elseif($currentlang=="fr-FR"): get_header('fr');
     else: get_header('de');
     endif;
    ?>

    Feel free to add as many elseif lines as you need.

    This can also work with other functions, like this:

    <?php
    $currentlang = get_bloginfo('language');
     if($currentlang=="en-GB"): _e ('We apologize, but we did not manage to match your query.');
     elseif($currentlang=="fr-FR"): _e ('Nous nous excusons, mais nous ne sommes pas parvenus pour correspondre à votre requête.');
     elseif($currentlang=="hu-HU"): _e ('Elnézést kérünk, de nem sikerült megfelelő lekérdezést.');
     elseif($currentlang=="de-DE"): _e ('Es tut uns leid, aber wir konnten nicht ihren vorstellungen entsprach.');
     else: _e ('Ne cerem scuze, nu am găsit nicio postare conform criteriilor selectate.');
     endif;
    ?>

    Or it can work with plain text, like this:

    <p>
     <?php
      $currentlang = get_bloginfo('language');
      if($currentlang=="en-GB"): echo "This is<br/>text";
      elseif($currentlang=="fr-FR"): echo "Ceci est un<br/>texte";
      elseif($currentlang=="hu-HU"): echo "Ez a<br/>szöveg";
      elseif($currentlang=="de-DE"): echo "Dies ist<br/>text";
      else: echo "Acesta este<br/>text";
      endif;
     ?>
    </p>

    Thanks so much for the plugin and help in the forums, I’ve translated the plugin to Romanian as well, I just need to figure out where/how to send it to you. If I don’t find where, I’ll leave a download link here for a few days.

    polylang-ro_RO.mo
    polylang-ro_RO.po

    Cheers!

    Thank you both, found what I was looking for in the Codex by searching for breadcrumbs. I’d rather not use plugins for this, and I’m fine with displaying just one category ^_^ Have a nice day, the both of you!

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