== New Features ==
Nested Fields
The new feature of nested fields allows you to repeat a set of fields with different field types.
Inline Mixed Field Type
The new built-in `inline_mixed` field type allows you to mix different field types in a single field with more flexible layouts.
Placement Argument
The new `placement` argument lets you place a chosen field in the field/section title area.
Term Meta Factory
The new `AdminPageFramework_TermMeta` class lets you add form fields in the term definition screens. This is similar to the existent `AdminPageFramework_TaxonomyFields` factory class but it supports the Term Meta API introduced in WordPress 4.4.
Fixes and Clean-ups
Several bugs have been patched and the directory structure has been restructured to shorten overall file paths.
More Changes
Find out the more details of new changes here.
== Getting Started ==

Write Your First Plugin
Let's create a very simple plugin to understand the whole workflow of using Admin Page Framework.
Step 1 - Get the Files

First, you need to have your own copy of the framework files.
1. Go to **Dashboard** -> **Admin Page Framework** -> **Tools** -> **[Generator](%WP_ADMIN_URL%/admin.php?page=apfl_tools)**.
2. **(Important!)** Enter your unique prefix. If your plugin is named, let's say "My First Plugin" then you may set the prefix "`MyFirstPlugin_`".
3. Also set the text domain of your project, `my-first-plugin` as an example. This will be used when creating translation files.
4. Download the file by pressing **Download**.
5. If download is successful, you'll get a zip file named `{your text domain-}admin-page-framework.zip`. Extract the contents to your preferred location at your convenience.
Make sure `admin-page-framework.php`, `admin-page-framework-include-class-list.php` and some other sub-directories are present in the extracted directory.
Step 2 - Include the Framework
Now it is time to code. In your code editor, insert your plugin header comment to tell WordPress that it is a plugin.
`
/* Plugin Name: My Plugin */
`
Next, you need to tell PHP to include the framework you just downloaded. The file name to include is `admin-page-framework.php`, the bootstrap script of the framework.
Assuming your class prefix set in the above step is `MyFirstPlugin_`, then your factory class name to extend will be `MyFirstPlugin_AdminPageFramework`. If you have not set the prefix, it will be just `AdminPageFramework`.
So check if that class name has been already loaded. And if not, load it. To load a PHP file, you can use the `include()` PHP function and pass the framework path to it (set your own path there).
`
include( dirname( __FILE__ ) . '/library/admin-page-framework/admin-page-framework.php' );
if ( ! class_exists( 'MyFirstPlugin_AdminPageFramework' ) ) {
return;
}
`
Step 3 - Extend the Factory Class
By extending the framework admin factory class, you can add your own desired functionality on top of it.
`
class MyFirstPlugin extends MyFirstPlugin_AdminPageFramework {
... our code comes here ...
}
`
Step 4 - Define the setUp() Method
Now we need to tell the framework what page to create.
The factory class already defines certain methods. If you extend the class, your extended class already has those methods.
The `setUp()` method is one of them, and in this method, you set up necessary configurations.
The `setRootMenuPage()` method allows you to set the top-level page and the `addSubMenuItem()` method allows you to add sub-menu pages and links.
Let's add a page to the `Settings` page. You need to decide what pag slug to use. Pick a unique one. Here we use `my_first_page` as an example.
`
public function setUp() {
$this->setRootMenuPage( 'Settings' );
$this->addSubMenuItem(
array(
'title' => 'My First Page',
'page_slug' => 'my_first_page',
)
);
}
`
Step 5 - Define the Methods for Hooks
Now you can insert your own output of the page with some of the pre-defined callback methods.
One of them is `do_{page slug}` method. You define a method named like so and it will be automatically gets called.
`
public function do_my_first_page() {
?>
Say Something
This is my first admin page!
Step 6 - Instantiate the Class
You need to instantiate the class you defined. When it is instantiated, it will run the internal constructor and takes care of everything needed to create admin pages for you.
`
new MyFirstPlugin;
`

And your code is now ready to run as a plugin. Compress it in a zip file and upload it to your WordPres site.
Example Plugin
**[Download](https://github.com/michaeluno/my-first-plugin/archive/master.zip)**
`
setRootMenuPage( 'Settings' );
$this->addSubMenuItem(
array(
'title' => 'My First Page',
'page_slug' => 'my_first_page'
)
);
}
/**
* Triggered in the middle of rendering the page.
*
* Inserts your custom contents here.
*
* @remark do_{page slug}
*/
public function do_my_first_page() {
?>
Say Something
This is my first admin page!
Documentation
- [Online Manual](http://admin-page-framework.michaeluno.jp/en/v3/package-AdminPageFramework.html).
- [Tutorials](http://admin-page-framework.michaeluno.jp/tutorials/)
Getting Helped
Have questions? Visit the [support forum](https://wordpress.org/support/plugin/admin-page-framework).
Help the Developer
Admin Page Framework won't grow without your support. There are various ways to contribute.
-
- Write a [review](https://wordpress.org/support/view/plugin-reviews/admin-page-framework?filter=5).
Get Involved
- Post [ideas](https://github.com/michaeluno/admin-page-framework/issues?direction=desc&labels=Enhancement&page=1&sort=created&state=open).
- Translate.
- Report [bugs](https://github.com/michaeluno/admin-page-framework/issues).