Documentation / Tutorials / Quick Samples
Creating custom metaboxes
/ Quick Samples / Creating custom metaboxes
You need to add the following in register post of the awesome core.
[register.custom_metabox screen='contents' id='contents_builder_metabox' title='Content Builder Metabox' callback_service='content_builder.metaboxes.layout' callback_save='content_builder.metaboxes.save' /]
- Where screen is the post type you want to show the meta box on
- Title : Which will be shown above the meta box.
- Callback_service: the service to call which will show the cusotm metabox fields.
- callback_save: the service which will be called when the post is saved.
Sample service to show the meta box
[templates.add layout] This is Layout BOX : [aw2.get template.post.ID /] [php.get_post_meta p1='{template.post.ID}' p2='simple_test' set='template.lay'/] [env.dump template.lay /] [/templates.add] [templates.add save] [php.update_post_meta p1='{template.post.ID}' p2='simple_test' p3='saved hua 2.0?' /] [/templates.add]
- The post object is passed as the template variable.
- Both this service were called in the register.custom_metabox shortcode above.
This sample requires Awesome Enterprise plugin version 1.3.4