public function display() { //switch based on current view $current_action = bp_action_variable(0); if ($current_action == 'create') { $this->view_create(); } elseif (bcg_is_single_post()) { $this->view_single(); } else { $this->view_blog(); } //just load the plugins template, above functions will attach the content generators bp_core_load_template('groups/single/plugins'); }
function bcg_fix_page_title($title, $sep, $seplocation) { if (!bcg_is_single_post()) { return $title; } $post = bcg_get_post_by_slug(bp_action_variable(0)); $post_title = $post->post_title; if ('right' == $seplocation) { // sep on right, so reverse the order $title = $post_title . " {$sep} " . $title; } else { $title = $title . " {$sep} " . $post_title; } return $title; }
function bcg_get_query() { $bp = buddypress(); $cats = bcg_get_categories($bp->groups->current_group->id); $qs = array('post_type' => bcg_get_post_type(), 'post_status' => 'publish'); if (empty($cats)) { $qs['name'] = -1; //we know it will not find anything } if (bcg_is_single_post()) { $slug = $bp->action_variables[0]; $qs['name'] = $slug; //tax query $qs['tax_query'] = array(array('taxonomy' => bcg_get_taxonomy(), 'terms' => $cats, 'field' => 'id', 'operator' => 'IN')); } $paged = get_query_var('paged') ? get_query_var('paged') : 1; if (bcg_is_category()) { $qs['tax_query'] = array(array('taxonomy' => bcg_get_taxonomy(), 'terms' => (int) bp_action_variable(1), 'field' => 'id', 'operator' => 'IN')); } else { $qs['tax_query'] = array(array('taxonomy' => bcg_get_taxonomy(), 'terms' => $cats, 'field' => 'id', 'operator' => 'IN')); } $qs['paged'] = $paged; return apply_filters("bcg_get_query", $qs); }
<?php do_action('bp_group_options_nav'); ?> </ul> </div> </div><!-- #item-nav --> <div id="item-body"> <div id="subnav" class="item-list-tabs no-ajax"> <ul> <?php bcg_get_options_menu(); ?> </ul> </div> <?php if (bcg_is_single_post()) { locate_template(array('bcg/single-post.php'), true); } else { if (bcg_is_post_create()) { locate_template(array('bcg/create.php'), true); } else { locate_template(array('bcg/blog.php'), true); } } ?> </div> <?php do_action('bp_after_group_blog_home_content'); ?>
/** * Enqueue comment js on single post screen */ public function enqueue_script() { if (bcg_is_single_post()) { wp_enqueue_script('comment-reply'); } }