File: example-screen-advanced.php

Recommend this page to a friend!
  Classes of Mahesh Waghmare  >  WordPress Fields Plugin  >  example-screen-advanced.php  >  Download  
File: example-screen-advanced.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: WordPress Fields Plugin
Add custom form fields to WordPress interface
Author: By
Last change:
Date: 2 years ago
Size: 12,924 bytes
 

Contents

Class file image Download
<?php
/**
 * Meta Fields (Screen - Advanced)
 */
mf_add_meta_box( array(
	'id'       => 'example-all-fields-advanced',
	'title'    => __( 'Example - All Fields Advanced' ),
	'screen'   => array( 'post' ),
	'context'  => 'advanced',
	'priority' => 'default',
	'fields' => array(
		'prefix-advanced-1-text' => array(
			'type'        => 'text',
			'title'       => 'Text Field',
			'description' => 'Text Field field description goes here.',
			'hint' => 'Text Field field description goes here.',
			'default'     => '',
		),
		'prefix-advanced-1-textarea' => array(
			'type'        => 'textarea',
			'title'       => 'Textarea',
			'description' => 'Textarea field description goes here.',
			'hint' => 'Textarea field description goes here.',
			'default'     => '',
		),
		'prefix-advanced-1-password' => array(
			'type'        => 'password',
			'title'       => 'Password',
			'description' => 'Password field description goes here.',
			'hint' => 'Password field description goes here.',
			'default'     => '',
		),
		'prefix-advanced-1-color' => array(
			'type'        => 'color',
			'title'       => 'Color',
			'description' => 'Color field description goes here.',
			'hint' => 'Color field description goes here.',
			'default'     => '#f3f3f3',
		),
		'prefix-advanced-1-date' => array(
			'type'        => 'date',
			'title'       => 'Date',
			'description' => 'Date field description goes here.',
			'hint' => 'Date field description goes here.',
			'default'     => '',
		),
		'prefix-advanced-1-datetime-local' => array(
			'type'        => 'datetime-local',
			'title'       => 'Date Time Local',
			'description' => 'Date Time Local field description goes here.',
			'hint' => 'Date Time Local field description goes here.',
			'default'     => '',
		),
		'prefix-advanced-1-email' => array(
			'type'        => 'email',
			'title'       => 'Email',
			'description' => 'Email field description goes here.',
			'hint' => 'Email field description goes here.',
			'default'     => '',
		),
		'prefix-advanced-1-month' => array(
			'type'        => 'month',
			'title'       => 'Month',
			'description' => 'Month field description goes here.',
			'hint' => 'Month field description goes here.',
			'default'     => '',
		),
		'prefix-advanced-1-number' => array(
			'type'        => 'number',
			'title'       => 'Number',
			'description' => 'Number field description goes here.',
			'hint' => 'Number field description goes here.',
			'default'     => '',
		),
		'prefix-advanced-1-time' => array(
			'type'        => 'time',
			'title'       => 'Time',
			'description' => 'Time field description goes here.',
			'hint' => 'Time field description goes here.',
			'default'     => '',
		),
		'prefix-advanced-1-week' => array(
			'type'        => 'week',
			'title'       => 'Week',
			'description' => 'Week field description goes here.',
			'hint' => 'Week field description goes here.',
			'default'     => '',
		),
		'prefix-advanced-1-url' => array(
			'type'        => 'url',
			'title'       => 'Url',
			'description' => 'Url field description goes here.',
			'hint' => 'Url field description goes here.',
			'default'     => '',
		),
		'prefix-advanced-1-checkbox' => array(
			'type'        => 'checkbox',
			'title'       => 'Checkbox',
			'description' => 'Checkbox field description goes here.',
			'hint'        => 'Checkbox field description goes here.',
			'default'     => true,
		),
		'prefix-advanced-1-radio' => array(
			'type'        => 'radio',
			'title'       => 'Radio',
			'description' => 'Radio field description goes here.',
			'hint' => 'Radio field description goes here.',
			'default'     => 'one',
			'choices' => array(
				'one'   => 'One',
				'two'   => 'Two',
				'three' => 'Three',
			),
		),
		'prefix-advanced-1-select' => array(
			'type'        => 'select',
			'title'       => 'Select',
			'description' => 'Select field description goes here.',
			'hint' => 'Select field description goes here.',
			'default'     => 'one',
			'choices' => array(
				'one'   => 'One',
				'two'   => 'Two',
				'three' => 'Three',
			),
		),
	)
) );

/**
 * Meta Fields (Grouped) (Screen - Advanced)
 */
mf_add_meta_box( array(
	'id'       => 'example-all-fields-advanced-grouped',
	'title'    => __( 'Example - All Fields (Grouped) Advanced' ),
	'screen'   => array( 'post' ),
	'context'  => 'advanced',
	'priority' => 'default',
	'groups'   => array(
		array(
			'title'       => 'Group 1',
			'description' => 'Group Description',
			'fields'      => array(
				'prefix-advanced-group-1-text' => array(
					'type'        => 'text',
					'title'       => 'Text Field',
					'description' => 'Text Field field description goes here.',
					'hint' => 'Text Field field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-1-textarea' => array(
					'type'        => 'textarea',
					'title'       => 'Textarea',
					'description' => 'Textarea field description goes here.',
					'hint' => 'Textarea field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-1-password' => array(
					'type'        => 'password',
					'title'       => 'Password',
					'description' => 'Password field description goes here.',
					'hint' => 'Password field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-1-color' => array(
					'type'        => 'color',
					'title'       => 'Color',
					'description' => 'Color field description goes here.',
					'hint' => 'Color field description goes here.',
					'default'     => '#f3f3f3',
				),
				'prefix-advanced-group-1-date' => array(
					'type'        => 'date',
					'title'       => 'Date',
					'description' => 'Date field description goes here.',
					'hint' => 'Date field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-1-datetime-local' => array(
					'type'        => 'datetime-local',
					'title'       => 'Date Time Local',
					'description' => 'Date Time Local field description goes here.',
					'hint' => 'Date Time Local field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-1-email' => array(
					'type'        => 'email',
					'title'       => 'Email',
					'description' => 'Email field description goes here.',
					'hint' => 'Email field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-1-month' => array(
					'type'        => 'month',
					'title'       => 'Month',
					'description' => 'Month field description goes here.',
					'hint' => 'Month field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-1-number' => array(
					'type'        => 'number',
					'title'       => 'Number',
					'description' => 'Number field description goes here.',
					'hint' => 'Number field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-1-time' => array(
					'type'        => 'time',
					'title'       => 'Time',
					'description' => 'Time field description goes here.',
					'hint' => 'Time field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-1-week' => array(
					'type'        => 'week',
					'title'       => 'Week',
					'description' => 'Week field description goes here.',
					'hint' => 'Week field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-1-url' => array(
					'type'        => 'url',
					'title'       => 'Url',
					'description' => 'Url field description goes here.',
					'hint' => 'Url field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-1-checkbox' => array(
					'type'        => 'checkbox',
					'title'       => 'Checkbox',
					'description' => 'Checkbox field description goes here.',
					'hint'        => 'Checkbox field description goes here.',
					'default'     => true,
				),
				'prefix-advanced-group-1-radio' => array(
					'type'        => 'radio',
					'title'       => 'Radio',
					'description' => 'Radio field description goes here.',
					'hint' => 'Radio field description goes here.',
					'default'     => 'one',
					'choices' => array(
						'one'   => 'One',
						'two'   => 'Two',
						'three' => 'Three',
					),
				),
				'prefix-advanced-group-1-select' => array(
					'type'        => 'select',
					'title'       => 'Select',
					'description' => 'Select field description goes here.',
					'hint' => 'Select field description goes here.',
					'default'     => 'one',
					'choices' => array(
						'one'   => 'One',
						'two'   => 'Two',
						'three' => 'Three',
					),
				),
			),
		),
		array(
			'title'       => 'Group 2',
			'description' => 'Group 2 Description',
			'fields'      => array(
				'prefix-advanced-group-2-text' => array(
					'type'        => 'text',
					'title'       => 'Text Field',
					'description' => 'Text Field field description goes here.',
					'hint' => 'Text Field field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-2-textarea' => array(
					'type'        => 'textarea',
					'title'       => 'Textarea',
					'description' => 'Textarea field description goes here.',
					'hint' => 'Textarea field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-2-password' => array(
					'type'        => 'password',
					'title'       => 'Password',
					'description' => 'Password field description goes here.',
					'hint' => 'Password field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-2-color' => array(
					'type'        => 'color',
					'title'       => 'Color',
					'description' => 'Color field description goes here.',
					'hint' => 'Color field description goes here.',
					'default'     => '#f3f3f3',
				),
				'prefix-advanced-group-2-date' => array(
					'type'        => 'date',
					'title'       => 'Date',
					'description' => 'Date field description goes here.',
					'hint' => 'Date field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-2-datetime-local' => array(
					'type'        => 'datetime-local',
					'title'       => 'Date Time Local',
					'description' => 'Date Time Local field description goes here.',
					'hint' => 'Date Time Local field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-2-email' => array(
					'type'        => 'email',
					'title'       => 'Email',
					'description' => 'Email field description goes here.',
					'hint' => 'Email field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-2-month' => array(
					'type'        => 'month',
					'title'       => 'Month',
					'description' => 'Month field description goes here.',
					'hint' => 'Month field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-2-number' => array(
					'type'        => 'number',
					'title'       => 'Number',
					'description' => 'Number field description goes here.',
					'hint' => 'Number field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-2-time' => array(
					'type'        => 'time',
					'title'       => 'Time',
					'description' => 'Time field description goes here.',
					'hint' => 'Time field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-2-week' => array(
					'type'        => 'week',
					'title'       => 'Week',
					'description' => 'Week field description goes here.',
					'hint' => 'Week field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-2-url' => array(
					'type'        => 'url',
					'title'       => 'Url',
					'description' => 'Url field description goes here.',
					'hint' => 'Url field description goes here.',
					'default'     => '',
				),
				'prefix-advanced-group-2-checkbox' => array(
					'type'        => 'checkbox',
					'title'       => 'Checkbox',
					'description' => 'Checkbox field description goes here.',
					'hint'        => 'Checkbox field description goes here.',
					'default'     => true,
				),
				'prefix-advanced-group-2-radio' => array(
					'type'        => 'radio',
					'title'       => 'Radio',
					'description' => 'Radio field description goes here.',
					'hint' => 'Radio field description goes here.',
					'default'     => 'one',
					'choices' => array(
						'one'   => 'One',
						'two'   => 'Two',
						'three' => 'Three',
					),
				),
				'prefix-advanced-group-2-select' => array(
					'type'        => 'select',
					'title'       => 'Select',
					'description' => 'Select field description goes here.',
					'hint' => 'Select field description goes here.',
					'default'     => 'one',
					'choices' => array(
						'one'   => 'One',
						'two'   => 'Two',
						'three' => 'Three',
					),
				),
			)
		)
	)
));

For more information send a message to info at phpclasses dot org.