Create tabbed navigation for WordPress admin dashboard, the OOP way.
- Install
- Usage
- Frequently Asked Questions
- Support
- Developing
- Running the Tests
- Feedback
- Change log
- Security
- Contributing
- Credits
- License
Installation should be done via composer, details of how to install composer can be found at https://getcomposer.org/.
$ composer require typisttech/wp-admin-tabs
You should put all WP Admin Tabs
classes under your own namespace to avoid class name conflicts.
$adminTabCollection = new AdminTabCollection();
$adminTabCollection->add(
new AdminTab('Blog', 'https://typist.tech'),
new AdminTab('Plugins', admin_url('plugins.php')),
new AdminTab('Users', admin_url('users.php')),
new AdminTab('Tab A', admin_url('users.php')),
new AdminTab('Tab B', admin_url('users.php')),
);
// This echos the tabs:
$adminTabCollection->render();
// This returns the HTML string of the tabs:
$html = $adminTabCollection->toHtml();
AdminTab
constructor.
- @param string $menuTitle The menu title of this tab.
- @param string $url The url of this tab.
new AdminTab('Blog', 'https://typist.tech');
new AdminTab('Blog', admin_url('plugins.php'));
Add admin tabs.
- @param AdminTab[] ...$adminTabs Admin tabs to be added.
$adminTabCollection = new AdminTabCollection();
// Add single admin tab.
$adminTabCollection->add(
new AdminTab('Users', admin_url('users.php'))
);
// Add multiple admin tabs.
$adminTabCollection->add(
new AdminTab('Blog', 'https://typist.tech'),
new AdminTab('Plugins', admin_url('plugins.php'))
);
Render the tabs with echo
.
$adminTabCollection = new AdminTabCollection();
$adminTabCollection->add(
new AdminTab('Blog', 'https://typist.tech'),
new AdminTab('Plugins', admin_url('plugins.php')),
new AdminTab('Users', admin_url('users.php'))
);
$adminTabCollection->render();
Converts the tabs to HTML string without echo
.
$adminTabCollection = new AdminTabCollection();
$adminTabCollection->add(
new AdminTab('Blog', 'https://typist.tech'),
new AdminTab('Plugins', admin_url('plugins.php')),
new AdminTab('Users', admin_url('users.php'))
);
$adminTabCollection->toHtml();
No, this is a package that should be part of your plugin.
Re-install packages via the following command. This package exports only necessary files to dist
.
$ composer install --no-dev --prefer-dist --optimize-autoloader
Yes, if put all WP Admin Tabs
classes under your own namespace to avoid class name conflicts.
Here you go:
Add your own plugin here
- Articles on Typist Tech's blog
- Tang Rufus' WordPress plugins on wp.org
- More projects on Typist Tech's GitHub profile
- Stay tuned on Typist Tech's newsletter
- Follow Tang Rufus' Twitter account
- Hire Tang Rufus to build your next awesome site
Love wp-admin-tabs
? Help me maintain it, a donation here can help with it.
Ready to take freelance WordPress jobs. Contact me via the contact form here or, via email [email protected]
Contact: Tang Rufus
To setup a developer workable version you should run these commands:
$ composer create-project --keep-vcs --no-install typisttech/wp-admin-tabs:dev-master
$ cd wp-admin-tabs
$ composer install
WP Admin Tabs run tests on Codeception and relies wp-browser to provide WordPress integration. Before testing, you have to install WordPress locally and add a codeception.yml file. See *.suite.example.yml for Local by Flywheel configuration examples.
Actually run the tests:
$ composer test
We also test all PHP files against PSR-2: Coding Style Guide and part of the WordPress coding standard.
Check the code style with $ composer check-style
.
Please provide feedback! We want to make this package useful in as many projects as possible. Please submit an issue and point out what you do and don't like, or fork the project and make suggestions. No issue is too small.
Please see CHANGELOG for more information on what has changed recently.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
WP Admin Tabs is a Typist Tech project and maintained by Tang Rufus, freelance developer for hire.
Full list of contributors can be found here.
WP Admin Tabs is licensed under the GPLv2 (or later) from the Free Software Foundation. Please see License File for more information.