public function question_content($template)
 {
     global $dwqa_options;
     $template_folder = trailingslashit(get_template_directory());
     if (is_singular('dwqa-question')) {
         ob_start();
         remove_filter('comments_open', array($this, 'close_default_comment'));
         echo '<div class="dwqa-container" >';
         dwqa_load_template('single', 'question');
         echo '</div>';
         $content = ob_get_contents();
         add_filter('comments_open', array($this, 'close_default_comment'));
         ob_end_clean();
         // Reset post
         global $post, $current_user;
         $this->reset_content(array('ID' => $post->ID, 'post_title' => $post->post_title, 'post_author' => 0, 'post_date' => $post->post_date, 'post_content' => $content, 'post_type' => 'dwqa-question', 'post_status' => $post->post_status, 'is_single' => true));
         $single_template = isset($dwqa_options['single-template']) ? $dwqa_options['single-template'] : false;
         $this->remove_all_filters('the_content');
         if ($single_template && file_exists($template_folder . $single_template)) {
             return $template_folder . $single_template;
         } else {
             return dwqa_get_template('single.php');
         }
     }
     if (is_tax('dwqa-question_category') || is_tax('dwqa-question_tag') || is_post_type_archive('dwqa-question') || is_post_type_archive('dwqa-answer')) {
         ob_start();
         echo '<div class="dwqa-container" >';
         dwqa_load_template('question', 'list');
         echo '</div>';
         $content = ob_get_contents();
         ob_end_clean();
         $post_id = isset($dwqa_options['pages']['archive-question']) ? $dwqa_options['pages']['archive-question'] : 0;
         if ($post_id) {
             $post = get_post($post_id);
             $this->reset_content(array('ID' => $post_id, 'post_title' => $post->post_title, 'post_author' => 0, 'post_date' => $post->post_date, 'post_content' => $content, 'post_type' => 'dwqa-question', 'post_status' => $post->post_status, 'is_archive' => true, 'comment_status' => 'closed'));
             $this->remove_all_filters('the_content');
             return dwqa_get_template('page.php');
         }
     }
     return $template;
 }
 public function question_content($template)
 {
     $dwqa_options = get_option('dwqa_options');
     $template_folder = trailingslashit(get_template_directory());
     if (isset($dwqa_options['pages']['archive-question'])) {
         $page_template = get_post_meta($dwqa_options['pages']['archive-question'], '_wp_page_template', true);
     }
     $page_template = isset($page_template) && !empty($page_template) ? $page_template : 'page.php';
     $this->page_template = $page_template;
     if (is_singular('dwqa-question')) {
         ob_start();
         remove_filter('comments_open', array($this, 'close_default_comment'));
         echo '<div class="dwqa-container" >';
         $this->load_template('single', 'question');
         echo '</div>';
         $content = ob_get_contents();
         add_filter('comments_open', array($this, 'close_default_comment'));
         ob_end_clean();
         // Reset post
         global $post, $current_user;
         $this->reset_content(array('ID' => $post->ID, 'post_title' => $post->post_title, 'post_author' => 0, 'post_date' => $post->post_date, 'post_content' => $content, 'post_type' => 'dwqa-question', 'post_status' => $post->post_status, 'is_single' => true));
         $single_template = isset($dwqa_options['single-template']) ? $dwqa_options['single-template'] : false;
         $this->remove_all_filters('the_content');
         add_filter('body_class', array($this, 'page_template_body_class'));
         return dwqa_get_template($page_template);
     }
     if (is_tax('dwqa-question_category') || is_tax('dwqa-question_tag') || is_post_type_archive('dwqa-question') || is_post_type_archive('dwqa-answer')) {
         global $wp_query;
         $post_id = isset($dwqa_options['pages']['archive-question']) ? $dwqa_options['pages']['archive-question'] : 0;
         if ($post_id) {
             $page = get_page($post_id);
             if (is_tax('dwqa-question_category') || is_tax('dwqa-question_tag')) {
                 $page->is_tax = true;
             }
             $this->reset_content($page);
             add_filter('body_class', array($this, 'page_template_body_class'));
             return dwqa_get_template($page_template);
         }
     }
     if (is_page($dwqa_options['pages']['archive-question'])) {
         global $wp_query;
         $wp_query->is_archive = true;
     }
     return $template;
 }