miriamdepaula

WordPress: Teste Metabox plugin

Jan 23rd, 2012
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.41 KB | None | 0 0
  1. <?php
  2. /*
  3. teste usando a classe de criação de metaboxes do Deluxe Blog Tips, que foi melhorado e transformado em plugin, atualizado para a versão 3.3 do WP
  4. Baixe e instale o plugin: http://www.deluxeblogtips.com/meta-box
  5. */
  6.  
  7. global $meta_boxes_pages;
  8. $meta_boxes_pages = array();
  9. $meta_boxes_pages[] = array(
  10.     'id' => 'mb_upload_banners',
  11.     'title' => 'Upload banners',
  12.     'pages' => array( 'page' ),  //só vai aparecer na criação de páginas! ehehe Use 'post', 'custom post type' ... para definir onde quer que apareça
  13.  
  14.     'fields' => array(
  15.        
  16.         array(
  17.             'name' => 'Banners (plupload)',
  18.             'desc' => 'Utilize este campo para definir quais banners aparecerão nesta página',
  19.             'id' => 'mb_banners',
  20.             'type' => 'plupload_image'       // Field type: plupload image upload
  21.         )
  22.     )
  23. );
  24. // Hook to 'admin_init' to make sure the meta box class is loaded before (in case using the meta box class in another plugin)
  25. // This is also helpful for some conditionals like checking page template, categories, etc.
  26. add_action( 'admin_init', 'register_banner_meta_boxes' );
  27.  
  28. /**
  29.  * Register meta boxes
  30.  *
  31.  * @return void
  32.  */
  33. function register_banner_meta_boxes()
  34. {
  35.     global $meta_boxes_pages;
  36.  
  37.     // Make sure there's no errors when the plugin is deactivated or during upgrade
  38.     if ( class_exists( 'RW_Meta_Box' ) )
  39.     {
  40.         foreach ( $meta_boxes_pages as $meta_box )
  41.         {
  42.             new RW_Meta_Box( $meta_box );
  43.         }
  44.     }
  45. }
  46.  
  47. ?>
Advertisement
Add Comment
Please, Sign In to add comment