承接 chandrapatel/wp-custom-settings 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

chandrapatel/wp-custom-settings

Composer 安装命令:

composer require chandrapatel/wp-custom-settings

包简介

Allows developers to create a custom admin menu page with settings using Settings API without registering callbacks to every settings section and field.

README 文档

README

Allows developers to create a custom admin menu page with settings using Settings API without registering callbacks to every settings section and field.

Supported form elements and input types

  • Textarea
  • Select
  • Input Types
    • Text
    • Password
    • Email
    • Url
    • Tel
    • Number
    • Color
    • Date
    • Datetime-local
    • Month
    • Week
    • Time

Installation

The plugin is available as a Composer package.

composer require chandrapatel/wp-custom-settings

Note: If you are not using Composer then I'd suggest to add WP Custom Settings main file in your theme or plugin instead of adding as standalone plugin. This way you can modify it as per your need and avoid dependency.

Usage

You need to create an object of WP_Custom_Settings class and it accepts three arguments to create menu page, register setting and sections & fields.

Please check example.php file.

$custom_settings = new WP_Custom_Settings(
	// Arguments to add menu page. Following arguments are same as add_menu_page() function arguments.
	// Callback argument does not needed.
	[
		'page_title' => __( 'Custom Settings', 'wp-custom-settings' ),
		'menu_title' => __( 'Custom Settings', 'wp-custom-settings' ),
		'capability' => 'manage_options',
		'menu_slug'  => 'wp-custom-settings-page',
		'icon_url'   => '',
		'position'   => null,
	],
	// Arguments to register setting. Following arguments are same as register_setting() function arguments.
	[
		'option_group' => 'wp_custom_settings_group',
		'option_name'  => 'wp_custom_settings_options',
		'args'         => array(
			'type'              => 'array',
			'description'       => 'Description of Custom Settings.',
			'show_in_rest'      => true,
			'default'           => array(),
			'sanitize_callback' => null,
		),
	],
	// Arguments to add sections and fields.
	[
		new WP_Custom_Settings_Section(
			'wp_custom_settings_section', // ID.
			__( 'Section Title.', 'wp-custom-settings' ), // Title.
			__( 'Section Description.', 'wp-custom-settings' ), // Description.
			[
				new WP_Custom_Settings_Field(
					'text', // Field type.
					'wp_custom_settings_field', // ID. Also, it will used for "name" attribute.
					__( 'Field Title', 'wp-settings-api-wrapper' ), // Title.
					[ // Pass additional arguments.
						'description' => 'Description of Custom Settings.',
						'label_for'   => 'wp_custom_settings_field',
						'class'       => 'regular-text',
					]
				),
			]
		),
	]
);

Screenshot

alt text

统计信息

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

GitHub 信息

  • Stars: 20
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2020-10-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固