Advertisement
Guest User

Untitled

a guest
Aug 15th, 2012
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.59 KB | None | 0 0
  1. /**
  2.  * Registering meta boxes
  3.  *
  4.  * All the definitions of meta boxes are listed below with comments.
  5.  * Please read them CAREFULLY.
  6.  *
  7.  * You also should read the changelog to know what has been changed before updating.
  8.  *
  9.  * For more information, please visit:
  10.  * @link http://www.deluxeblogtips.com/meta-box/docs/define-meta-boxes
  11.  */
  12.  
  13. /********************* META BOX DEFINITIONS ***********************/
  14.  
  15. /**
  16.  * Prefix of meta keys (optional)
  17.  * Use underscore (_) at the beginning to make keys hidden
  18.  * Alt.: You also can make prefix empty to disable it
  19.  */
  20. // Better has an underscore as last sign
  21. $prefix = 'YOUR_PREFIX_';
  22.  
  23. global $meta_boxes;
  24.  
  25. $meta_boxes = array();
  26.  
  27. $meta_boxes[] = array(
  28.     'id' => 'yurt',
  29.     'title' => 'Yurt bilgileri',
  30.     'pages' => array( 'post' ),
  31.     'context' => 'normal',
  32.     'priority' => 'high',
  33.     'fields' => array(
  34.         array(
  35.             'name' => 'Özel üye',
  36.             'id'   => 'ozel-uye',
  37.             'type' => 'checkbox_list',
  38.             'options' => array(
  39.                 'manset' => 'Manşet',
  40.                 'vitrin' => 'Vitrin',
  41.             ),
  42.         ),
  43.         array(
  44.             'name' => 'Adres',
  45.             'id' => 'adres',
  46.             'type' => 'textarea',
  47.             'cols' => '40',
  48.             'rows' => '3',
  49.         ),
  50.         array(
  51.             'name' => 'Telefon',
  52.             'id' => 'telefon',
  53.             'type' => 'textarea',
  54.             'cols' => '40',
  55.             'rows' => '3',
  56.         ),
  57.         array(
  58.             'name' => 'Web site',
  59.             'id' => 'web-site',
  60.             'type' => 'text',
  61.             'desc' => 'Başında <code>http://</code> olmadan ekleyiniz!',
  62.         ),
  63.         array(
  64.             'name' => 'Cinsiyet',
  65.             'id' => 'cinsiyet',
  66.             'type' => 'radio',
  67.             'options' => array(
  68.                 'Erkek' => 'Erkek',
  69.                 'Kız' => 'Kız',
  70.             )
  71.         ),
  72.         array(
  73.             'name' => 'Yurt logo',
  74.             'id' => 'yurt-logo',
  75.             'type' => 'plupload_image',
  76.             'max_file_uploads' => 1,
  77.         ),
  78.         array(
  79.             'name' => 'Yurt özellikleri',
  80.             'id' => 'yurt-ozellikleri',
  81.             'type' => 'wysiwyg',
  82.             'std' => '<ul><li>Etüd Odası</li><li>TV Salonu</li></ul>',
  83.         ),
  84.     )
  85. );
  86.  
  87. /********************* META BOX REGISTERING ***********************/
  88.  
  89. /**
  90.  * Register meta boxes
  91.  *
  92.  * @return void
  93.  */
  94. function YOUR_PREFIX_register_meta_boxes()
  95. {
  96.     global $meta_boxes;
  97.  
  98.     // Make sure there's no errors when the plugin is deactivated or during upgrade
  99.     if ( class_exists( 'RW_Meta_Box' ) )
  100.     {
  101.         foreach ( $meta_boxes as $meta_box )
  102.         {
  103.             new RW_Meta_Box( $meta_box );
  104.         }
  105.     }
  106. }
  107. // Hook to 'admin_init' to make sure the meta box class is loaded before
  108. // (in case using the meta box class in another plugin)
  109. // This is also helpful for some conditionals like checking page template, categories, etc.
  110. add_action( 'admin_init', 'YOUR_PREFIX_register_meta_boxes' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement