PHP code example of sujin / wp-express
1. Go to this page and download the library: Download sujin/wp-express library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sujin / wp-express example snippets
use Sujin\Wordpress\WP_Express\Admin;
use Sujin\Wordpress\WP_Express\Settings_Section;
use Sujin\Wordpress\WP_Express\Fields\Settings\Input;
// Create a new admin page in the root of admin menu
$admin_page_root = Admin::get_instance( 'Admin Root');
// Change position by position id
$admin_page_root->position( 200 );
// Create another admin page under $test_admin_page_1
$admin_page_child = Admin::get_instance( 'Admin Child' )
->position( $root );
// Change position under Settings
$admin_page_child->position( 'settings' );
// Change position under other menu
$admin_page_child->position( 'Plugin Name' );
// Add a link in the Plugins list
$admin_page_child->plugin( 'Akismet' );
// Set menu icon (use WP Dashicons)
$admin_page_child->icon( 'dashicons-buddicons-activity' );
// Create a new setttings section (default location is settings page)
$settings_section = Settings_Section::get_instance( 'Settings Section' );
// Append the settings section into the admin page
$admin_page_child->append( $settings_section );
// Create a new settting field `headline`
$headline = Input::get_instance( 'Headline' );
// Append the input into the settings section
$settings_section->append( $headline );
// Change the input type to date
$headline->type( 'date' );
// Change the input to the multiple value
$headline->single( false );
// Settngs could be the chaining assignment
$headline
->show_in_rest( true )
->single( true )
->append_to( $settings_section );