advantage_meta_box

The Advantage advantage meta box function.

Description

advantage_meta_box(); 

Usage

  1. if ( !function_exists( 'advantage_meta_box' ) ) { 
  2. require_once '/inc/lib-admin.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = advantage_meta_box(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/inc/lib-admin.php  
  1. function advantage_meta_box() { 
  2. global $advantage_meta_box; 
  3.  
  4. $advantage_meta_box['page'] = array(  
  5. 'id' => 'advantage-page-meta',  
  6. 'title' => __('Template Options (advantage)', 'advantage'),  
  7. 'context' => 'side', //normal, advaned, side  
  8. 'priority' => 'low', //high, core, default, low 
  9. 'fields' => array( 
  10. array( 
  11. 'name' => __('Post Category :', 'advantage'),  
  12. 'desc' => '',  
  13. 'id' => '_advantage_category',  
  14. 'type' => 'category',  
  15. 'default' => '' 
  16. ),  
  17. array( 
  18. 'name' => __( 'Posts per page :', 'advantage' ),  
  19. 'desc' => '',  
  20. 'id' => '_advantage_postperpage',  
  21. 'type' => 'number',  
  22. 'default' => '',  
  23. ),  
  24. array( 
  25. 'name' => __('Page Title :', 'advantage'),  
  26. 'desc' => __('check to hide page title', 'advantage'),  
  27. 'id' => '_advantage_title',  
  28. 'type' => 'checkbox',  
  29. 'default' => '',  
  30. ),  
  31. array( 
  32. 'name' => __('Sidebar :', 'advantage'),  
  33. 'desc' => __('check to display sidebar', 'advantage'),  
  34. 'id' => '_advantage_sidebar',  
  35. 'type' => 'checkbox',  
  36. 'default' => '',  
  37. ),  
  38. array( 
  39. 'name' => __('Layout :', 'advantage'),  
  40. 'desc' => __('Columns', 'advantage'),  
  41. 'id' => '_advantage_column',  
  42. 'type' => 'select',  
  43. 'default' => '',  
  44. 'options' => array(  
  45. array( 'key' => '1',  
  46. 'name' => '1' ),  
  47. array( 'key' => '2',  
  48. 'name' => '2' ),  
  49. array( 'key' => '', //Dedault 
  50. 'name' => '3' ),  
  51. array( 'key' => '4',  
  52. 'name' => '4' ),  
  53. ),  
  54. ),  
  55. array( 
  56. 'name' => __('Image Size : ', 'advantage'),  
  57. 'desc' => '',  
  58. 'id' => '_advantage_thumbnail',  
  59. 'type' => 'select',  
  60. 'default' => '',  
  61. 'options' => advantage_thumbnail_array(),  
  62. ),  
  63. array( 
  64. 'name' => __('Custom Size (Width) :', 'advantage'),  
  65. 'desc' => '',  
  66. 'id' => '_advantage_size_x',  
  67. 'type' => 'number',  
  68. 'default' => '',  
  69. ),  
  70. array( 
  71. 'name' => __('Custom Size (Height) :', 'advantage'),  
  72. 'desc' => '',  
  73. 'id' => '_advantage_size_y',  
  74. 'type' => 'number',  
  75. 'default' => '',  
  76. ),  
  77. array( 
  78. 'name' => __('Intro Text : <br />', 'advantage'),  
  79. 'desc' => '',  
  80. 'id' => '_advantage_intro',  
  81. 'type' => 'radio',  
  82. 'default' => '',  
  83. 'options' => array(  
  84. array( 'key' => '',  
  85. 'name' => __('Excerpt<br />', 'advantage') ),  
  86. array( 'key' => '2',  
  87. 'name' => __('Content<br />', 'advantage') ),  
  88. array( 'key' => '3',  
  89. 'name' => __('None<br />', 'advantage') ),  
  90. ),  
  91. ),  
  92. array( 
  93. 'name' => __('Post Meta :', 'advantage'),  
  94. 'desc' => __('check to display post meta', 'advantage'),  
  95. 'id' => '_advantage_disp_meta',  
  96. 'type' => 'checkbox',  
  97. 'default' => '',  
  98. ),  
  99. array( 
  100. 'name' => 'Data',  
  101. 'desc' => 'Data',  
  102. 'id' => '_advantage_pt_data',  
  103. 'type' => 'hidden',  
  104. 'default' => '',  
  105. ),  
  106. ); 
  107. $advantage_meta_box['post'] = array(  
  108. 'id' => 'advantage-post-meta',  
  109. 'title' => __('advantage Post Options', 'advantage'),  
  110. 'context' => 'side', //normal, advaned, side  
  111. 'priority' => 'high', //high, core, default, low 
  112. 'fields' => array( 
  113. array( 
  114. 'name' => __('Layout :', 'advantage'),  
  115. 'desc' => '',  
  116. 'id' => '_advantage_layout',  
  117. 'type' => 'select',  
  118. 'default' => '',  
  119. 'options' => array(  
  120. array( 'key' => '', //Dedault 
  121. 'name' => __( 'Default', 'advantage' ) ),  
  122. array( 'key' => '1',  
  123. 'name' => __( 'Fullwidth', 'advantage' ) ),  
  124. array( 'key' => '2',  
  125. 'name' => __( 'Fullscreen', 'advantage' ) ) ),  
  126. ),  
  127. array( 
  128. 'name' => '',  
  129. 'desc' => __('Featured Post', 'advantage'),  
  130. 'id' => '_advantage_featured',  
  131. 'type' => 'checkbox',  
  132. 'default' => '',  
  133. ),  
  134. array( 
  135. 'name' => __('Read More Label :', 'advantage'),  
  136. 'desc' => '',  
  137. 'id' => '_advantage_readmore',  
  138. 'type' => 'text',  
  139. 'default' => '',  
  140. ),  
  141. ); 
  142.  
  143. foreach( $advantage_meta_box as $post_type => $value ) { 
  144. add_meta_box( $value['id'], $value['title'], 'advantage_meta_display', $post_type, $value['context'], $value['priority'] );