-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeta-box.php
More file actions
47 lines (42 loc) · 1.43 KB
/
meta-box.php
File metadata and controls
47 lines (42 loc) · 1.43 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
<?php
/*
** meta-box.php handles adding the utu event input fields across events, courses,
* lessons, posts, and pages
*/
add_action( 'admin_menu', 'utu_create_meta_box' );
add_action( 'admin_menu', 'page_create_meta_box' );
add_action( 'admin_menu', 'job_create_meta_box' );
add_action( 'save_post', 'utu_update_event_label' );
function utu_create_meta_box(){
if( function_exists('add_meta_box') ){
add_meta_box( 'utu-event-label', 'uTu Event Label', 'utu_event_box', 'post' );
}
}
function page_create_meta_box(){
if( function_exists('add_meta_box') ){
add_meta_box( 'utu-event-label', 'uTu Event Label', 'utu_event_box', 'page' );
}
}
function job_create_meta_box(){
if( function_exists('add_meta_box') ){
add_meta_box( 'utu-event-label', 'uTu Event Label', 'utu_event_box', 'jobpost' );
}
}
function utu_event_box(){
global $post;
$utu_event_label = get_post_meta( $post->ID, 'utu_event_label', true );
?>
<table class="form_table">
<tr>
<th width="30%"><label for="utu_event_label">uTu Event</label></th>
<td width="70%"><input type="text" size="60" name="utu_event_label" value="<?php echo $utu_event_label; ?>" /></td>
</tr>
</table>
<?php
}
function utu_update_event_label( $post_id ){
if( isset($_POST['utu_event_label']) ){
update_post_meta( $post_id, 'utu_event_label', $_POST['utu_event_label'] );
}
}
?>