<?php $paged = get_query_var('paged') ? get_query_var('paged') : 1; $type = isset($_GET['type']) ? $_GET['type'] : 'question'; $args = array('post_type' => $type, 'paged' => $paged, 'author' => $user->ID); //show pending question if current is author if ($current_user->ID == $user->ID) { $args['post_status'] = array('publish', 'pending'); } //tab following questions if (isset($_GET['type']) && $_GET['type'] == "following") { $follow_questions = array_filter((array) get_user_meta($user->ID, 'qa_following_questions', true)); $args['post_type'] = $type = "question"; $args['post__in'] = !empty($follow_questions) ? $follow_questions : array(0); unset($args['author']); } $query = QA_Questions::get_questions($args); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); get_template_part('mobile/template/' . $type, 'loop'); } } else { echo '<li class="no-questions">'; echo '<h2>' . __('There are no questions yet.', ET_DOMAIN) . '</h2>'; echo '</li>'; } wp_reset_query(); ?> </ul> </div> </div>
</section> <!-- MIDDLE BAR / END --> <!-- LIST QUESTION --> <section class="list-question-wrapper"> <div class="container"> <div class="row"> <div class="col-md-12"> <ul class="list-question"> <?php if (get_query_var('page')) { $paged = get_query_var('page') ? get_query_var('page') : 1; } else { $paged = get_query_var('paged') ? get_query_var('paged') : 1; } $query = QA_Questions::get_questions(array('post_type' => 'question', 'paged' => $paged)); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); get_template_part('mobile/template/question', 'loop'); } } wp_reset_query(); ?> </ul> </div> </div> </div> </section> <!-- LIST QUESTION / END --> <section class="list-pagination-wrapper">