Option tree demo theme option

<?php

add_action( 'admin_init', 'my_theme_custom_theme_options', 1 );


function my_theme_custom_theme_options() {

  $saved_settings = get_option( 'option_tree_settings', array() );
  

  $custom_settings = array(
    'contextual_help' => array(
      'content'       => array( 
        array(
          'id'        => 'general_help',
          'title'     => 'General',
          'content'   => '<p>Help content goes here!</p>'
        )
      ),
      'sidebar'       => '<p>Sidebar content goes here!</p>'
    ),
    'sections'        => array(
      array(
        'title'       => 'General',
        'id'          => 'general_default'
      )
    ),
    'settings'        => array(
      array(
        'label'       => 'News page Banner',
        'id'          => 'news_page_banner',
        'type'        => 'upload',
        'section'     => 'general_default'
      )
    )
  );
  

  $custom_settings = apply_filters( 'option_tree_settings_args', $custom_settings );
  

  if ( $saved_settings !== $custom_settings ) {
    update_option( 'option_tree_settings', $custom_settings ); 
  }
  
}
The following two tabs change content below.

Leave a Reply

Your email address will not be published. Required fields are marked *