Discourse::comments_template PHP Метод

comments_template() публичный Метод

public comments_template ( $old )
    function comments_template($old)
    {
        global $post;
        if (self::use_discourse_comments($post->ID)) {
            self::sync_comments($post->ID);
            $options = self::get_plugin_options();
            $num_WP_comments = get_comments_number();
            if (!$options['show-existing-comments'] || $num_WP_comments == 0) {
                // only show the Discourse comments
                return WPDISCOURSE_PATH . '/templates/comments.php';
            } else {
                // show the Discourse comments then show the existing WP comments (in $old)
                include WPDISCOURSE_PATH . '/templates/comments.php';
                echo '<div class="discourse-existing-comments-heading">' . wp_kses_post($options['existing-comments-heading']) . '</div>';
                return $old;
            }
        }
        // show the existing WP comments
        return $old;
    }