Advertisement
arnabkumar

Creating Simple Options Panel using Option Tree

Apr 20th, 2014
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.77 KB | None | 0 0
  1. <!-- Creating Simple Option Tree In the theme-->
  2.        
  3.  
  4.     <?php
  5.      
  6.     add_action( 'admin_init', 'custom_theme_options', 1 );
  7.      
  8.     function custom_theme_options() {
  9.      
  10.       $saved_settings = get_option( 'option_tree_settings', array() );
  11.      
  12.      
  13.       $custom_settings = array(
  14.         'contextual_help' => array( //This is help section if u want create
  15.       'content'       => array(     //anoter this just create anothe array
  16.         array(                      // like this with ,
  17.                                                 /* array(
  18.                                                   'id'        => 'Home_Top_help',
  19.                                                   'title'     => __( 'Home_Top'),
  20.                                                   'content'   => '<p>' . __( 'You can edit Top page from hare ', 'theme-text-domain' ) . '</p>'
  21.                                                 )*/
  22.        
  23.           'id'        => 'Home_Top_help',
  24.           'title'     => __( 'Home_Top'),
  25.           'content'   => '<p>' . __( 'You can edit Top page from hare ', 'theme-text-domain' ) . '</p>'
  26.         )
  27.       )
  28.     ),
  29.       'sections'        => array(
  30.           array(
  31.             'id'          => 'general',
  32.             'title'       => 'Site Settings'
  33.           )
  34.         ),
  35.         'settings'        => array(
  36.           array(
  37.             'id'          => 'logo_text',
  38.             'label'       => 'Logo Text',
  39.             'desc'        => 'Use H1, H2, H3 tag',
  40.             'type'        => 'textarea',
  41.             'section'     => 'general'
  42.           ),
  43.           array(
  44.             'id'          => 'footer_text',
  45.             'label'       => 'Footer Text',
  46.             'type'        => 'textarea',
  47.             'section'     => 'general'
  48.           )
  49.         )
  50.       );
  51.      
  52.       if ( $saved_settings !== $custom_settings ) {
  53.         update_option( 'option_tree_settings', $custom_settings );
  54.       }
  55.      
  56.     }
  57.      ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement