定制 underdev/settings 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

underdev/settings

Composer 安装命令:

composer require underdev/settings

包简介

Settings library for WordPress plugins

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version

This is a library which helps adding custom settings pages for WordPress plugins and themes.

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;

统计信息

  • 总下载量: 200
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2017-03-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固