Add member directory loop to custom bp nav item
-
I have the following code creating a custom buddypress menu item no problem.
function mb_bp_profile_menu_posts() { global $bp; bp_core_new_nav_item( array( 'name' => 'Member Directory', 'slug' => 'directory', 'parent_url' => $bp->loggedin_user->domain . '/' , 'position' => 40, 'default_subnav_slug' => 'directory', 'screen_function' => 'wbc_member_directory' ) ); } add_action('bp_setup_nav', 'mb_bp_profile_menu_posts', 301 ); /* we're building 2 sub item * the first is the one showing by default */ function mb_bp_profile_submenu_posts() { global $bp; if(!is_user_logged_in()) return ''; bp_core_new_subnav_item( array( 'name' => 'WBC Members', 'slug' => 'directory', 'parent_url' => $bp->loggedin_user->domain . $bp->bp_nav['directory']['slug'] . '/' , 'parent_slug' => $bp->bp_nav['directory']['slug'], 'position' => 10, 'screen_function' => 'wbc_member_directory' //the function is declared below ) ); } add_action('bp_setup_nav', 'mb_bp_profile_submenu_posts', 302 ); /* here we control our 1st sub item * first function is the screen_function * second function displays the content */ function wbc_member_directory(){ add_action( 'bp_template_content', 'mb_show_posts' ); bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'buddypress/members/single/plugins' ) ); } function mb_show_posts() { echo 'TEST'; // add yout stuff here }I can only get it to output text e.g. ‘TEST’ on the page itself. I want to pump in the member directory. Any help please? Pretty sure its a function, action or hook?!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Add member directory loop to custom bp nav item’ is closed to new replies.