• I have a website with a plugin that generates PDF files out of post content and qTranslate installed for handling multi-language content.

    The problem:
    The PDF plugin unfortunately does not recognize the languages correctly resulting in wrong content being put into the final file. I fixed the issue but the solution requires to pass a current language code to the plugin so it gets the right post content lang version.

    The code:

    if(qtrans_getLanguage()=='en') {
          $code= "en";
        } elseif(qtrans_getLanguage()=='de') {
          $code= "de";
        }

    The code above is used to pass the variable with the current lang code. It works in theme files, does not pasted directly to the plugin or functions.php. (I’m probably doing sth wrong here but I’m def. not a pro at php coding 🙂

    Other info:

    • Adding the variable $code =’en’; manually in functions.php and calling it in the plugin via global $code; gets the job done nicely.

    Thanks in advance

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Pass a php variable to a plugin’ is closed to new replies.