2017 © Pedro Peláez
 

library settings

Settings library for WordPress plugins

image

underdev/settings

Settings library for WordPress plugins

  • Tuesday, January 9, 2018
  • by underDEV
  • Repository
  • 1 Watchers
  • 1 Stars
  • 65 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 3 % Grown

The README.md

Latest Stable Version Total Downloads Latest Unstable Version, (*1)

This is a library which helps adding custom settings pages for WordPress plugins and themes., (*2)

Sample usage

require_once( 'vendor/autoload.php' );

use underDEV\Utils\Settings\CoreFields;

class SettingsExample {

    public function __construct() {

        // init library with your handle
        $this->settings = new underDEV\Utils\Settings( 'example' );

        // register menu as always
        add_action( 'admin_menu', array( $this, 'register_menu' ) );

        // register some settings
        add_action( 'init', array( $this, 'register_settings' ) );

    }

    public function register_menu() {

        // pass the page hook to library to load scripts only on settings pages
        $this->settings->page_hook = add_options_page(
            __( 'Example Settings' ),
            __( 'Example Settings' ),
            'manage_options',
            'example-settings',
            array( $this->settings, 'settings_page' )
        );

    }

    public function register_settings() {

        $general = $this->settings->add_section( __( 'General' ), 'general' );

        $general->add_group( __( 'Pages' ), 'pages' )
            ->add_field( array(
                'name'        => __( 'Results Page' ),
                'slug'        => 'results',
                'addons'      => array(
                    'pretty'   => true,
                    'options'  => array( 'asd1', 'asd2', 'asd3' )
                ),
                'description' => __( 'The page that will be used for the search results.' ),
                'render'      => array( new CoreFields\Select(), 'input' ),
                'sanitize'    => array( new CoreFields\Select(), 'sanitize' ),
            ) )
            ->description( __( 'These are the default Pages plugin will use to display it\'s content' ) );

    }

}

new SettingsExample;

The Versions

09/01 2018

dev-develop

dev-develop

Settings library for WordPress plugins

  Sources   Download

by Kuba Mikita

09/01 2018

dev-master

9999999-dev

Settings library for WordPress plugins

  Sources   Download

by Kuba Mikita

09/01 2018

1.3

1.3.0.0

Settings library for WordPress plugins

  Sources   Download

by Kuba Mikita

14/06 2017

1.2

1.2.0.0

Settings library for WordPress plugins

  Sources   Download

by Kuba Mikita

08/06 2017

1.1.1

1.1.1.0

Settings library for WordPress plugins

  Sources   Download

by Kuba Mikita

08/06 2017

1.1

1.1.0.0

Settings library for WordPress plugins

  Sources   Download

by Kuba Mikita

11/03 2017

1.0

1.0.0.0

Settings library for WordPress plugins

  Sources   Download

by Kuba Mikita