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' /]
  1. Where screen is the post type you want to show the meta box on
  2. Title : Which will be shown above the meta box.
  3. Callback_service: the service to call which will show the cusotm metabox fields.
  4. 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]

 

  1. The post  object is passed as the template variable.
  2. Both this service were called in the register.custom_metabox shortcode above.

This sample requires Awesome Enterprise plugin version 1.3.4

Categories
Most Popular

Leave a Reply

Your email address will not be published.