Last active
April 12, 2024 11:59
-
-
Save KaineLabs/2cc8898e1d6b04a85d8fb30058a0734a to your computer and use it in GitHub Desktop.
Create Custom Groups Tab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Create Custom Groups Tab | |
*/ | |
add_action( 'bp_actions', 'yzc_create_custom_group_tab' ); | |
function yzc_create_custom_group_tab() { | |
if ( bp_is_active( 'groups' ) && bp_is_groups_component() && bp_is_single_item() ) { | |
global $bp; | |
// Get Current Group. | |
$current_group = $bp->groups->current_group; | |
// Add New Group Tab. | |
bp_core_new_subnav_item( | |
array( | |
'position' => 12, | |
'slug' => 'custom-tab', | |
'name' => __( 'Custom Tab', 'youzify' ), | |
'parent_slug' => $current_group->slug, | |
'parent_url' => bp_get_group_permalink( $current_group ), | |
'screen_function' => 'yzc_custom_group_tab', | |
), 'groups' | |
); | |
} | |
} | |
/** | |
* Custom Group Tab Content | |
*/ | |
function yzc_custom_group_tab_content() { | |
echo 'test'; | |
} | |
/** | |
* Custom Group Tab Content | |
*/ | |
function yzc_custom_group_tab() { | |
// Call Tab Content. | |
add_action( 'bp_template_content', 'yzc_custom_group_tab_content' ); | |
// Load Tab Template | |
bp_core_load_template( 'buddypress/groups/single/plugins' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment