Advertisement
Guest User

Untitled

a guest
Apr 13th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. <?php
  2. // Register settings page. In this case, it's a theme options page
  3. add_filter( 'mb_settings_pages', 'prefix_options_page' );
  4. function prefix_options_page( $settings_pages )
  5. {
  6. $settings_pages[] = array(
  7. 'id' => 'pencil',
  8. 'option_name' => 'pencil',
  9. 'menu_title' => __( 'Pencil', 'textdomain' ),
  10. 'icon_url' => 'dashicons-edit',
  11. 'style' => 'no-boxes',
  12. 'columns' => 1,
  13. 'tabs' => array(
  14. 'general' => __( 'General Settings', 'textdomain' ),
  15. 'design' => __( 'Design Customization', 'textdomain' ),
  16. 'faq' => __( 'FAQ & Help', 'textdomain' ),
  17. ),
  18. 'position' => 68,
  19. );
  20. return $settings_pages;
  21. }
  22. // Register meta boxes and fields for settings page
  23. add_filter( 'rwmb_meta_boxes', 'prefix_options_meta_boxes' );
  24. function prefix_options_meta_boxes( $meta_boxes )
  25. {
  26. $meta_boxes[] = array(
  27. 'id' => 'general',
  28. 'title' => __( 'General', 'textdomain' ),
  29. 'settings_pages' => 'pencil',
  30. 'tab' => 'general',
  31. 'fields' => array(
  32. array(
  33. 'name' => __( 'Logo', 'textdomain' ),
  34. 'id' => 'logo',
  35. 'type' => 'file_input',
  36. ),
  37. array(
  38. 'name' => __( 'Layout', 'textdomain' ),
  39. 'id' => 'layout',
  40. 'type' => 'image_select',
  41. 'options' => array(
  42. 'sidebar-left' => 'http://i.imgur.com/Y2sxQ2R.png',
  43. 'sidebar-right' => 'http://i.imgur.com/h7ONxhz.png',
  44. 'no-sidebar' => 'http://i.imgur.com/m7oQKvk.png',
  45. ),
  46. ),
  47. ),
  48. );
  49. $meta_boxes[] = array(
  50. 'id' => 'colors',
  51. 'title' => __( 'Colors', 'textdomain' ),
  52. 'settings_pages' => 'pencil',
  53. 'tab' => 'design',
  54. 'fields' => array(
  55. array(
  56. 'name' => __( 'Heading Color', 'textdomain' ),
  57. 'id' => 'heading-color',
  58. 'type' => 'color',
  59. ),
  60. array(
  61. 'name' => __( 'Text Color', 'textdomain' ),
  62. 'id' => 'text-color',
  63. 'type' => 'color',
  64. ),
  65. ),
  66. );
  67. $meta_boxes[] = array(
  68. 'id' => 'info',
  69. 'title' => __( 'Theme Info', 'textdomain' ),
  70. 'settings_pages' => 'pencil',
  71. 'tab' => 'faq',
  72. 'fields' => array(
  73. array(
  74. 'type' => 'custom_html',
  75. 'std' => __( '<strong>Having questions?</strong><br><br><a href="https://metabox.io/docs/" target="_blank" class="button-primary">Go to our documentation</a>', 'textdomain' ),
  76. ),
  77. ),
  78. );
  79. return $meta_boxes;
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement