Quantcast
Channel: polylang – WordPress.org Forums
Viewing all articles
Browse latest Browse all 11471

BraveThrasher on "Polylang together with EU Cookie Law Compliance plugin"

$
0
0

Polylang is integrated into EU Cookie Law Compliance with the following code:

if (is_plugin_active('polylang/polylang.php') && function_exists('pll_current_language') && function_exists('pll_the_languages')) {
            if (!is_admin()) {
                self::$language = pll_current_language('slug');
            } else {
                global $polylang;
                if (!(!$polylang->get_languages_list())) {
                    $pll_options    = get_option('polylang');
                    self::$language = $pll_options['default_language'];
                    if (isset($_GET['lang']) && isset($_GET['page']) && $_GET['page'] == 'cookie-compliance-settings') {
                        self::$language = $_GET['lang'];
                    }
                    foreach ($polylang->get_languages_list() as $language) {
                        $language                           = get_object_vars($language);
                        self::$languages[$language['slug']] = $language['name'];
                    }
                    self::$languagechoice = true;
                }
            }
        }

I have noticed that pll_current_language('slug') returns null.
What needs to be changed to make this snippet work with Polylang version 1.3.1?


Viewing all articles
Browse latest Browse all 11471

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>