Display new tabs in selected groups only (group extension API)
-
Hi,
I have created a tab in groups that redirects to members directory, using this code in function.php:
if ( class_exists( 'BP_Group_Extension' ) ) : class members_nav_tab_in_group extends BP_Group_Extension { function __construct() { $args = array( 'slug' => '../../members', 'name' => 'Members directory', 'nav_item_position' => 105, ); parent::init( $args ); } } bp_register_group_extension( 'members_nav_tab_in_group' ); endif;
It works well, but I now need this tab to appear only in 1 group and not all.
The access or show_tab arguments don’t seem to serve my objective, so I have tried to restrict my code by adding:
global $bp; $group_id = $bp->groups->current_group->id; if ( $group_id == '2' ) :
But then the tab disappears in all groups.
Any idea how to display this tab only in selected groups?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Display new tabs in selected groups only (group extension API)’ is closed to new replies.