• Resolved leemon

    (@leemon)


    Hi,

    I’m trying to develop a plugin for Polylang and I have a question. How can I get the main Polylang object to use its model in the plugin? This is a rough draft of the code I’m using:

    class PolylangPlugin {
    
        public $model;
    
        public function __construct($polylang) {
            $this->model = &$polylang->model;
        }
    }
    
    new PolylangPlugin( ????????? );

    Any help would be appreciated

    https://wordpress.org/plugins/polylang/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chouby

    (@chouby)

    Hi!

    There is a global variable $polylang available. I however recommend to use the API when possible as internal code accessible through the global $polylang is subject to changes.

    Thread Starter leemon

    (@leemon)

    Thanks! I’ll try to use the API functions as much as possible.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Creating a plugin for Polylang’ is closed to new replies.