Skip to content

sultann/metabox

Repository files navigation

Metabox

Description

Metabox is a developer's toolkit for building metaboxes, custom fields, and forms for WordPress that will blow your mind. Easily manage meta for custom post types.

You can see a list of available field types here.

Installation

  1. Place the metabox directory inside of your theme or plugin.
  2. Now include the metabox class require dirname(__FILE__) . '/metabox/class-metabox.php';.
add_action( 'admin_init', 'add_custom_metabox' );

function(add_custom_metabox){
    $metabox = new \Pluginever\Framework\Metabox( 'html-id' );

		$config  = array(
			'title'        => __( 'Metabox Settings', 'wpcp' ),
			'screen'       => 'post',
			'context'      => 'normal',
			'priority'     => 'high',
			'lazy_loading' => 'true',
			'class'        => 'custom-class',
			'fields'       => [
				[
					'type'  => 'text',
					'label' => __( 'Example Field', 'wpcp' ),
					'name'  => 'example_field',
					'sanitize'  => 'esc_html',
				],

			],
		);

		$metabox->init( $config );
}
  1. Profit.

View CHANGELOG

Releases

No releases published

Packages

No packages published