Advertisement
raselahmed7

Creating Simple Options Panel using Option Tree

Jan 6th, 2013
1,573
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.91 KB | None | 0 0
  1. <?php
  2.  
  3. add_action( 'admin_init', 'custom_theme_options', 1 );
  4.  
  5. function custom_theme_options() {
  6.  
  7.   $saved_settings = get_option( 'option_tree_settings', array() );
  8.  
  9.  
  10.   $custom_settings = array(
  11.     'sections'        => array(
  12.       array(
  13.         'id'          => 'general',
  14.         'title'       => 'Site Settings'
  15.       )
  16.     ),
  17.     'settings'        => array(
  18.       array(
  19.         'id'          => 'logo_text',
  20.         'label'       => 'Logo Text',
  21.         'desc'        => 'Use H1, H2, H3 tag',
  22.         'type'        => 'textarea',
  23.         'section'     => 'general'
  24.       ),
  25.       array(
  26.         'id'          => 'footer_text',
  27.         'label'       => 'Footer Text',
  28.         'type'        => 'textarea',
  29.         'section'     => 'general'
  30.       )
  31.     )
  32.   );
  33.  
  34.   if ( $saved_settings !== $custom_settings ) {
  35.     update_option( 'option_tree_settings', $custom_settings );
  36.   }
  37.  
  38. }
  39.  ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement