Skip to content
A really basic WordPress helper class that allows theme and plugin authors to easily create meta boxes with just running a configuration function.
PHP JavaScript
Branch: master
Clone or download
Pull request Compare This branch is 7 commits ahead of nyordanov:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
scripts
smart_meta_fields
.gitignore
README.md
SmartMetaBox.php

README.md

Smart Meta Box

This is a really basic helper class for WordPress themes and plugins that allows their authors to easily manage meta boxes.

What's new in this fork?

You now have the following types:

  • text - Simple text-field
  • textarea - Simple textarea
  • checkbox - Checkboxes
  • select - Select with options
  • radio - Radio buttons

New types

  • wp_editor - Wordpress TinyMCE textarea
  • image - Image upload
  • date - Datepicker

Template condition

You can also choose to only show the meta box on a certain template using the new template option

$options = array(
	'template' => array('frontpage-template.php')
);

Example usage

add_smart_meta_box('post_settings', array(
	'title'		=> __('Settings for post', 'mytextdomain'),
	'pages'		=> array('post'),
	'template'	=> array('frontpage-template.php'),
	'context'	=> 'advanced',
	'priority'	=> 'high',
	'fields'	=> array(
		array(
			'name' 		=> __('My setting:', 'mytextdomain'),
			'id' 		=> 'my_setting',
			'default'	=> '',
			'desc' 		=> __('Please enter your setting value', 'mytextdomain'),
			'type' 		=> 'text',
		),
	)
));
You can’t perform that action at this time.