queue  50
support
Results 1 to 7 of 7

Thread: Magnum theme incompatible with Polylang plugin

  1. #1
    Junior Member
    Join Date
    Apr 2017
    Posts
    5

    Magnum theme incompatible with Polylang plugin

    Hi,

    I tried to install the Polygang plugin on my website with the Magnum theme and I have an error on my website when he's running.

    Fatal error: Call to a member function get_default_language() on a non-object in /framework/php/PeTheme/PeThemeWPML.php on line 67

    Line 65-68 of PeThemeWPML.php file:
    PHP Code:
    public function deflang() {
            global 
    $sitepress;
            return 
    $sitepress->get_default_language();
        } 
    What can I do to fix the compatibility? Please,

    Elric,

  2. #2
    Lead Coder Fabio's Avatar
    Join Date
    Aug 2011
    Posts
    2,081
    Hello,

    it seems the polylang plugins uses the same constant name as WPML plugin so it triggers the error because theme tries to load the WPML plugin which isn't present.
    you can solve the issue by removing the line

    PHP Code:
    $this->wpml->instantiate(); 
    in the file framework/php/PeTheme/PeThemeController.php
    My cave is full of servers

  3. #3
    Junior Member
    Join Date
    Apr 2017
    Posts
    5
    Hi Fabio,

    Thank you for your answer.

    I tried your solution (removing the line) but I still have the same error when the website is loading.

  4. #4
    Lead Coder Fabio's Avatar
    Join Date
    Aug 2011
    Posts
    2,081
    That's weird, it should have worked.

    Try to replace whole PeThemeWPML.php file content with
    Code:
    <?php
    class PeThemeWPML {}
    ?>
    My cave is full of servers

  5. #5
    Junior Member
    Join Date
    Apr 2017
    Posts
    5
    I tried it and now I have:

    Fatal error: Call to undefined method PeThemeWPML::notDefaultLanguage() in wp-content/themes/magnum papa/framework/php/PeTheme/PeThemeOptions.php on line 24

    Line 24-30:
    PHP Code:
            if (defined('ICL_LANGUAGE_CODE') && $this->master->wpml->notDefaultLanguage()) {
                
    $this->slugLang $this->slug."_".ICL_LANGUAGE_CODE;
                
    $lang get_option($this->slugLang,null);
                if (
    is_array($lang)) {
                    
    $this->options = (object) array_merge((array) $this->options,$lang);
                }
            } 

  6. #6
    Lead Coder Fabio's Avatar
    Join Date
    Aug 2011
    Posts
    2,081
    You can remove that block (whole if)
    My cave is full of servers

  7. #7
    Junior Member
    Join Date
    Apr 2017
    Posts
    5
    It worked. Thanks a lot Fabio.

    Have a good one,
    Elric,