-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathREADME.txt
31 lines (22 loc) · 1.28 KB
/
README.txt
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
# CF Revision Manager
The CF Revision Manager will take registered post meta fields and version them when post-revisions are made. The post-meta is duplicated and attached to the specific post-revision that is made. Registered post meta items will appear in the post-revision inspection screen. Post meta items do not show up in the post-comparison feature.
## Registering Your Post Meta
The CFR plugin includes a registration function to easily include your post-meta in the revision scheme.
function my_registered_post_meta_item() {
if (function_exists('cfr_register_metadata')) {
cfr_register_metadata('my_metadata_key');
}
}
add_action('init', 'my_registered_post_meta_item');
## Prettifying Your Post Meta
By default the post meta is run through `print_r` (if its an object or array) and then through `htmlspecialchars`. Register a callback function along with your post meta key to override the default display of your post meta in the revision screen.
function my_registered_post_meta_item() {
if (function_exists('cfr_register_metadata')) {
cfr_register_metadata('my_metadata_key', 'prettify_my_postmeta');
}
}
add_action('init', 'my_registered_post_meta_item');
function prettify_my_postmeta($postmeta) {
// make the post meta data presentable
return $postmeta;
}