GithubHelp home page GithubHelp logo

voce-post-meta's Introduction

Voce Post Meta

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

voce-post-meta's People

Contributors

banderon avatar jeffstieler avatar johnciacia avatar kevinlangleyjr avatar matgargano avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.