/** * Display our content when the nav item is selected * * @return void */ public function display($group_id = null) { // perform query for this group // NOTE: query is currently disabled $group_query = new WP_Query(array('post_type' => 'cacsp_paper', 'author' => -1, 'post_status' => 'publish', 'bp_group' => $group_id)); ?> <div class="entry-content"> <?php if ($group_query->have_posts()) { ?> <ul class="item-list"> <?php while ($group_query->have_posts()) { $group_query->the_post(); ?> <?php cacsp_get_template_part('list-social-paper', 'buddypress'); ?> <?php } ?> </ul> <?php } else { ?> <p><?php _e('No group papers found.', 'social-paper'); ?> </p> <?php } ?> </div> <?php }
if (is_search()) { ?> <h2 class="currently-searching"><?php printf(__('Found the following results for: %s', 'social-paper'), '<span class="search-terms">' . get_search_query() . '</span>'); ?> </h2> <?php } ?> <?php cacsp_pagination(); ?> <ul class="item-list"> <?php while (have_posts()) { the_post(); ?> <?php cacsp_get_template_part('list-social-paper', 'buddypress'); ?> <?php } ?> </ul> <?php cacsp_pagination('bottom');
<?php if (have_posts()) { ?> <?php cacsp_get_template_part('archive-header', 'social-paper'); ?> <ul> <?php // Start the Loop. while (have_posts()) { the_post(); cacsp_get_template_part('list-social-paper'); // End the loop. } ?> </ul> <?php } else { ?> <?php if (is_user_logged_in()) { ?> <p><?php
/** * AJAX callback on the paper directory page to dynamically load papers. */ function cacsp_ajax_directory_template_callback() { // Bail if not a POST action if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } // Bail if no object passed if (empty($_POST['object']) || 'papers' !== $_POST['object']) { return; } $scope = !empty($_POST['scope']) ? $_POST['scope'] : 'all'; $args = array('post_type' => 'cacsp_paper', 'post_status' => 'publish'); if (!empty($_POST['search_terms'])) { $args['s'] = $_POST['search_terms']; } switch ($scope) { case 'personal': $args['author'] = bp_loggedin_user_id(); $args['post_status'] = array('publish', 'private', 'draft', 'future'); break; default: $args = apply_filters('bp_papers_ajax_query_args', $args, $scope); break; } // perform query $GLOBALS['wp_query'] = new WP_Query($args); if (have_posts()) { cacsp_get_template_part('loop-social-paper', 'buddypress'); // no papers } else { ?> <div id="message" class="info"> <p><?php _e('Sorry, no papers were found.', 'social-paper'); ?> </p> </div> <?php } exit; }