PHP code example of dsawardekar / wp-options-manager

1. Go to this page and download the library: Download dsawardekar/wp-options-manager 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/ */

    

dsawardekar / wp-options-manager example snippets


$container->object('script', new \WpOptionsManager\OptionsManager($container));
$container->singleton('optionsValidator', 'MyOptionsValidator');
$container->singleton('optionsPage', 'MyOptionsPage');

class MyOptionsPage extends \WpOptionsManager\OptionsPage {

  function getTemplateContext() {
    return array(
      'foo' => $this->getOption('foo')
    );
  }

}

class MyOptionsValidator extends \WpOptionsManager\OptionsValidator {

  function loadRules($validator) {
    $validator->rule('