Guest User

Bp nav

a guest
Apr 16th, 2012
993
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function my_test_setup_nav() {
  2. global $bp;
  3.  
  4. $parent_slug = 'test';
  5. $child_slug = 'test_sub';
  6. //name, slug, screen, position, default subnav
  7. bp_core_new_nav_item( array( 'name' => __( 'test' ), 'slug' => $parent_slug, 'screen_function' => 'my_profile_page_function_to_show_screen', 'position' => 40, 'default_subnav_slug' => 'test_sub' ) );
  8.  
  9. /* Add the subnav items to the profile */
  10. // name, slug, parent_url, parent slug, screen function
  11. bp_core_new_subnav_item( array( 'name' => __( 'Home' ), 'slug' => $child_slug, 'parent_url' => $bp->loggedin_user->domain . 'test/', 'parent_slug' => $parent_slug, 'screen_function' => 'my_profile_page_function_to_show_screen' ) );
  12.  
  13. bp_core_new_subnav_item( array( 'name' => __( 'Random Stuff' ), 'slug' => 'random', 'parent_url' => $bp->loggedin_user->domain . 'test/', 'parent_slug' => $parent_slug, 'screen_function' => 'my_profile_page_function_to_show_screen234' ) );
  14.  
  15. function my_profile_page_function_to_show_screen() {
  16.  
  17. //add title and content here - last is to call the members plugin.php template
  18. add_action( 'bp_template_title', 'my_profile_page_function_to_show_screen_title' );
  19. add_action( 'bp_template_content', 'my_profile_page_function_to_show_screen_content' );
  20. bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
  21. }
  22. function my_profile_page_function_to_show_screen_title() {
  23. echo 'something';
  24. }
  25. function my_profile_page_function_to_show_screen_content() {
  26.  
  27. echo 'weee content';
  28.  
  29. }
  30. //random page content:
  31. function my_profile_page_function_to_show_screen234() {
  32. //add content here - last is to call the members plugin.php template
  33. add_action( 'bp_template_content', 'my_profile_page_function_to_show_screen234_content' );
  34. bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
  35. }
  36. function my_profile_page_function_to_show_screen234_content() {
  37.  
  38. echo 'This is a random page.';
  39.  
  40. }
  41. }
  42. add_action( 'bp_setup_nav', 'my_test_setup_nav' );
  43.  
  44. ?>
RAW Paste Data