Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/objectivco/wp_tabbed_navigation
Automate creating a tabbed navigation and maintaining tabbed states
https://github.com/objectivco/wp_tabbed_navigation
Last synced: about 1 month ago
JSON representation
Automate creating a tabbed navigation and maintaining tabbed states
- Host: GitHub
- URL: https://github.com/objectivco/wp_tabbed_navigation
- Owner: Objectivco
- License: gpl-3.0
- Created: 2017-10-13T15:37:44.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-04-07T21:29:45.000Z (almost 4 years ago)
- Last Synced: 2024-04-28T09:21:43.813Z (8 months ago)
- Language: PHP
- Size: 17.6 KB
- Stars: 5
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WP_Tabbed_Navigation
Automate creating a tabbed navigation and maintaining tabbed states## Installing
Use composer:
```txt
composer require objectivco/wp_tabbed_navigation
```Or include the file. (But really, just use composer)
## Initiating the Tab System
```php
$wp_tabbed_navigation = new WP_Tabbed_Navigation( 'My Plugin Settings', $selected_tab_query_arg = 'subpage' );
```## Setup Some Submenus
### These will be linked to our tab'
```php
add_options_page( __( 'My Plugin Settings', 'my-plugin' ), __( 'My Plugin Settings', 'my-plugin' ), 'manage_options', 'my-plugin-settings', array($this, 'admin_page') );
```## Setup Tabs Using The Same Menu Slugs
```php
$wp_tabbed_navigation->add_tab( 'Settings', add_query_arg( array('subpage' => 'settings'), menu_page_url('my-plugin-settings', false) ) );
$wp_tabbed_navigation->add_tab( 'Add-ons', add_query_arg( array('subpage' => 'addons'), menu_page_url('my-plugin-settings', false) ) );
$wp_tabbed_navigation->add_tab( 'License', add_query_arg( array('subpage' => 'license'), menu_page_url('my-plugin-settings', false) ) );
$wp_tabbed_navigation->add_tab( 'Support', add_query_arg( array('subpage' => 'support'), menu_page_url('my-plugin-settings', false) ) );
```## Displaying the Tabs
### Add this to the top of each admin page in a tab.```php
$wp_tabbed_navigation->display_tabs();
```## That's it! Have fun kids.