[buddypress-trac] [BuddyPress] #2427: Plugin: expanding bp_nav_items for WP 3.0

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Sat Jun 5 21:56:09 UTC 2010


#2427: Plugin: expanding bp_nav_items for  WP 3.0
---------------------+------------------------------------------------------
 Reporter:  mercime  |       Owner:     
     Type:  defect   |      Status:  new
 Priority:  major    |   Milestone:  1.3
Component:  Core     |    Keywords:     
---------------------+------------------------------------------------------

Comment(by r-a-y):

 This should be quite easy.

 I'm not using WP 3.0, but try these little functions in your theme's
 functions.php:

 {{{
 // filter to exclude BP pages from wp_list_pages() - don't use this as a
 template tag!
 function bp_exclude_wp_list_pages( $exclude_array ) {
         global $current_blog;

         if ( defined( 'BP_ENABLE_MULTIBLOG' ) )
                 $page_ids = get_blog_option( $current_blog->blog_id, 'bp-
 pages' );
         else
                 $page_ids = get_blog_option( BP_ROOT_BLOG, 'bp-pages' );

         if ( empty( $page_ids ) )
                 return $exclude_array;

         $exclude_merge = array_merge( $page_ids, $exclude_array );

         return $exclude_merge;
 }
 add_filter( 'wp_list_pages_excludes', 'bp_exclude_wp_list_pages' );


 // template tag to list only BP pages
 function bp_list_pages() {
         global $current_blog;

         if ( defined( 'BP_ENABLE_MULTIBLOG' ) )
                 $page_ids = get_blog_option( $current_blog->blog_id, 'bp-
 pages' );
         else
                 $page_ids = get_blog_option( BP_ROOT_BLOG, 'bp-pages' );

         if ( empty( $page_ids ) )
                 return false;

         $page_ids_delimited = implode( ',', (array)$page_ids );

         wp_list_pages( 'include=' . $page_ids_delimited );
 }
 }}}

-- 
Ticket URL: <http://trac.buddypress.org/ticket/2427#comment:1>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list