bp_core_admin_tabs( string $active_tab = '', string $context = 'settings' )

Output the tabs in the admin area.


Parameters Parameters

$active_tab

(string) (Optional) Name of the tab that is active. Optional.

Default value: ''

$context

(string) (Optional) The context of use for the tabs. Defaults to 'settings'. Possible values are 'settings' & 'tools'.

Default value: 'settings'


Source Source

File: bp-core/admin/bp-core-admin-functions.php

function bp_core_admin_tabs( $active_tab = '', $context = 'settings' ) {
	$tabs_html    = '';
	$idle_class   = 'nav-tab';
	$active_class = 'nav-tab nav-tab-active';

	/**
	 * Filters the admin tabs to be displayed.
	 *
	 * @since 1.9.0
	 *
	 * @param array $value Array of tabs to output to the admin area.
	 */
	$tabs = apply_filters( 'bp_core_admin_tabs', bp_core_get_admin_tabs( $active_tab, $context ) );

	// Loop through tabs and build navigation.
	foreach ( array_values( $tabs ) as $tab_data ) {
		$is_current = (bool) ( $tab_data['name'] == $active_tab );
		$tab_class  = $is_current ? $active_class : $idle_class;
		$tabs_html .= '<a href="' . esc_url( $tab_data['href'] ) . '" class="' . esc_attr( $tab_class ) . '">' . esc_html( $tab_data['name'] ) . '</a>';
	}

	echo $tabs_html;

	/**
	 * Fires after the output of tabs for the admin area.
	 *
	 * @since 1.5.0
	 * @since 8.0.0 Adds the `$context` parameter.
	 *
	 * @param string $context The context of use for the tabs.
	 */
	do_action( 'bp_admin_tabs', $context );
}


Top ↑

Changelog Changelog

Changelog
Version Description
8.0.0 Adds the $context parameter.
1.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.