Discourse::discourse_comments_js PHP Method

discourse_comments_js() public method

    function discourse_comments_js()
    {
        // Allowed post type
        if (is_singular(self::get_allowed_post_types())) {
            // Publish to Discourse enabled
            if (self::use_discourse_comments(get_the_ID())) {
                // Enqueue script
                wp_enqueue_script('discourse-comments-js', WPDISCOURSE_URL . '/js/comments.js', array('jquery'), self::$version, true);
                // Localize script
                $discourse_options = self::get_plugin_options();
                $data = array('url' => $discourse_options['url']);
                wp_localize_script('discourse-comments-js', 'discourse', $data);
            }
        }
    }