Creating Your First Admin Page

Several things of note before beginning:

  • Everything we do with this framework is going to flow through the wpstudio_init action hook.
  • The creation function has three parts:
    1. The options for the admin page.
    2. The creation of a variable that contains the admin page settings.
    3. Each individual field along with field-specific options all handled inside a PHP array.
  • There are standard parameters that are used for every field type. And several field types have additional parameters that are specific to that field.
  • There are two recommended methods of extracting the values out of the saved fields and are universally used across admin pages.

Quick Start

<?php
add_action( 'wpstudio_init', 'quickstart_admin_page' );
function quickstart_admin_page(){
    $options = array(
        'id' => 'quickstart-admin',
        'title' => __( 'QuickStart WPStudio Framework Admin', 'wpstudio' ),
        'menu_title' => __( 'QuickStart', 'wpstudio' ),
        'icon' => 'dashicons-awards',
    );
    $wpstudio = wpstudio_new_admin_page( $options );
}

Adding Your First Fields