You appear to be a bot. Output may be restricted
Description
Display the nav_tabsMany WordPress admin pages display a series of tabs and underneath that we see may also see a subsection. Most routines hard code the logic. This is the bobbingwide/oik approach.
In any admin page that that can display a series of tabs you code bw_nav_tabs()
passing the defaults for the first page that you're creating That seems fair enough. The routine invokes "bw_nav_tabs_$page", passing the name of the currently selected $tab
The implementing plugin can use the tab name to decide whether or not to load any code. Which will get invoked by the action invoked subsequently.
See oik-clone for an example. Note: If there is no $page then the filter invoked is "bw_nav_tabs_"
If you want to display subsections then you do this in action hook for the selected tab.
Usage
$string = bw_nav_tabs( $default_tab, $default_label );
Parameters
- $default_tab
- ( string ) optional – the default tab for a tabbed admin page
- $default_label
- ( string ) optional – the default label for a tabbed admin page
Returns
string $tab – the currently selected tabTO DO
Code to be developed – for different Authentication methods of the WP-API solutionSource
File name: oik/includes/bw-nav-tab.phpLines:
function bw_nav_tabs( $default_tab=null, $default_label=null ) { $tab = bw_array_get( $_REQUEST, "tab", $default_tab ); //bw_trace2( $tab, "tab" ); $_REQUEST['tab'] = $tab; $page = bw_array_get( $_REQUEST, "page", null ); stag( "h2", "nav-tab-wrapper"); $nav_tabs = array( $default_tab => $default_label ); $nav_tabs = apply_filters( "bw_nav_tabs_$page", $nav_tabs, $tab ); foreach ( $nav_tabs as $nav_tab => $nav_label ) { bw_nav_tab_link( $nav_tab, $nav_label, $page, $tab ); } etag( "h2" ); return( $tab ); }View on GitHub View on Trac