1. Go to this page and download the library: Download yivi/wp_optional 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/ */
yivi / wp_optional example snippets
$page_settings = new PageSettings(
'options_id',
'Options Page Title',
'Options Menu Title',
'options-general.php', // options menu parent
'manage_options' // capability
$field = $page_general->addField(
// string identifying the field (will be concatenated to the section, page and options id)
$id,
// will be used as a label for the <input> element
$title,
// this should be a class that extends AbstractField,
$type
);