JoeHana
10/14/2013 - 12:38 AM

Register and define Custom Meta Box

Register and define Custom Meta Box

<?php

/**
 * Register custom meta box
 */

add_action( 'admin_init', 'custom_register_meta_boxes' );

function custom_register_meta_boxes() {

	if ( ! class_exists( 'RW_Meta_Box' ) )
		return;
		
	$meta_box = wpsight_meta_box_custom();
	
    new RW_Meta_Box( $meta_box );

}

/**
 * Create custom meta box
 */

function wpsight_meta_box_custom() {
	
	// custom labels
	$custom_labels = array(
		'title' 		=> __( 'Metabox Title', 'wpsight' ),
	);

	// set meta box
	$meta_box = array(
	
		'id' 		  => 'custom_meta',
		'title'		  => $custom_labels['title'],
		'pages'		  => array( wpsight_listing_post_type() ),
		'context'	  => 'normal',
		'priority'	  => 'high',
		'fields'	  => array(    		
			'custom_1' => array(
				'name'  => __('Custom 1', 'wpsight'),
				'id'    => '_custom_1',
				'type'  => 'text',
				'desc'	=> __('Description for Custom 1', 'wpsight')
			),
		)
		
	);

	return $meta_box;

}