voceconnect/voce-post-meta 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

voceconnect/voce-post-meta

最新稳定版本:1.9.2

Composer 安装命令:

composer require voceconnect/voce-post-meta

包简介

Easily create post metaboxes and add fields

README 文档

README

Contributors: prettyboymp, kevinlangleyjr, jeffstieler, markparolisi, banderon
Tags: post, meta
Requires at least: 3.5
Tested up to: 4.2.2
Stable tag: 1.9.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Description

Create a group (metabox), then add fields to it.

Installation

As standard plugin:

See Installing Plugins.

As theme or plugin dependency:

After dropping the plugin into the containing theme or plugin, add the following:

if( ! class_exists( 'Voce_Meta_API' ) ) {
	require_once( $path_to_voce_post_meta . '/voce-post-meta.php' );
}

Usage

Example

<?php
add_action('init', function(){
	add_metadata_group( 'demo_meta', 'Page Options', array(
		'capability' => 'edit_posts'
	));
	add_metadata_field( 'demo_meta', 'demo_key', 'Title', 'text', array(
		'description' => 'Descriptive string. Example: <code>Description</code>'
	) );
	add_post_type_support( 'page', 'demo_meta' );
});
?>

Input Types

By default, Voce Post Meta comes with support for these input types:

Text Inputs

  • text - A one line text input field.
  • textarea - A basic multiline text field.
  • numberic - The same as text field but sanitizes as a number on save.
  • wp_editor - Uses the full WordPress post content editor, for more advanced editing scenarios.

Selection

  • dropdown - A dropdown select field.
  • radio - Radio button selection field.
  • checkbox - Checkbox input field for on/off toggling.

The dropdown and radio fields expect an options argument passed into the options array. The options should be an array of $value => $label pairs.

This field is optional for the checkbox field; utilizing it will allow for multiple checkboxes under the same field and will cause the value to save as an array.

Additionally, for radio fields and checkbox fields that use the options argument, an item_container argument is available to specify the HTML tag used to wrap the individual items. The only currently allowed values are div (default) and span.

Misc

  • hidden A hidden input field for saving meta outside of user control.

Standard Field Options

These are the optional args that all default fields accept, and that any extended fields are expected to handle.

<?php
array(
	'description' => '', // A short description of the expected value displayed with the field.
	'default_value' => '', // The value to be shown and used when not set.
	
	// Override options
	'capability' => '', // User permission level that must be met to edit the field. Defaults to edit_posts
	'display_callbacks' => array(), // An array of valid callable functions to render the field display.
	'sanitize_callbacks' => array() // An array of callable functions to sanitize the field value on save.
);
?>

Changelog

Please refer to the full changelog at https://github.com/voceconnect/voce-post-meta/releases

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 13
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: GPLv2
  • 更新时间: 2013-10-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固