-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmetaboxes.php
More file actions
98 lines (70 loc) · 2.2 KB
/
Copy pathmetaboxes.php
File metadata and controls
98 lines (70 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
// Re-define meta box path and URL
define( 'RWMB_URL', trailingslashit( get_stylesheet_directory_uri() . '/meta-box' ) );
define( 'RWMB_DIR', trailingslashit( TEMPLATEPATH . '/meta-box' ) );
// Include the meta box script
require_once RWMB_DIR . 'meta-box.php';
// Include the meta box definition (the file where you define meta boxes, see `demo/demo.php`)
/**
* Registering meta boxes
*
* All the definitions of meta boxes are listed below with comments.
* Please read them CAREFULLY.
*
* You also should read the changelog to know what has been changed before updating.
*
* For more information, please visit:
* @link http://www.deluxeblogtips.com/meta-box/docs/define-meta-boxes
*/
/********************* META BOX DEFINITIONS ***********************/
/**
* Prefix of meta keys (optional)
* Use underscore (_) at the beginning to make keys hidden
* Alt.: You also can make prefix empty to disable it
*/
// Better has an underscore as last sign
$prefix = 'YOUR_PREFIX_';
global $meta_boxes;
$meta_boxes = array();
// Page Metabox
$meta_boxes[] = array(
'id' => 'locationsinfo',
'title' => 'Location Info',
'pages' => array( 'page' ),
'fields' => array(
array(
'name' => 'Phone',
'id' => "location_phone",
'type' => 'textarea',
'std' => '(P) 205.214.5500'
),
array(
'name' => 'Fax',
'id' => "location_fax",
'type' => 'textarea',
'std' => '(F) 225.218.9471'
),
)
);
/********************* META BOX REGISTERING ***********************/
/**
* Register meta boxes
*
* @return void
*/
function YOUR_PREFIX_register_meta_boxes()
{
global $meta_boxes;
// Make sure there's no errors when the plugin is deactivated or during upgrade
if ( class_exists( 'RW_Meta_Box' ) )
{
foreach ( $meta_boxes as $meta_box )
{
new RW_Meta_Box( $meta_box );
}
}
}
// Hook to 'admin_init' to make sure the meta box class is loaded before
// (in case using the meta box class in another plugin)
// This is also helpful for some conditionals like checking page template, categories, etc.
add_action( 'admin_init', 'YOUR_PREFIX_register_meta_boxes' );