OptionTree is one of the best available option panel for WordPress and is also used in most of Premium WordPress themes.With its wonderful user interface and special features including Drag Drop and Order Items makes it a versatile theme options UI builder.You can install it as a plugin but this tutorial will help you to integrate it in your WordPress Theme without having to download and activate it via plugin page.The tutorial also covers how to make option pages through code instead of using UI builder page provided by the plugin.
So Here are the steps
Download and extract the plugin zipped file into the theme folder.e.g if your theme folder name is onepager then there will be a folder name option-tree inside it.
Cope and paste the following code into functions.php
/** * Optional: set 'ot_show_pages' filter to false. * This will hide the settings & documentation pages. */ add_filter( 'ot_show_pages', '__return_false' ); /** * Required: set 'ot_theme_mode' filter to true. */ add_filter( 'ot_theme_mode', '__return_true' ); /** * Required: include OptionTree. */ include_once( 'option-tree/ot-loader.php' ); /** * Theme Options */ include_once( 'includes/theme-options.php' );
Go to option-tree folder inside theme folder and open the ot-loader.php file.Search the following line of code and set the ot_theme_mode value to true
define( 'OT_THEME_MODE', apply_filters( 'ot_theme_mode', true ) );
Create a folder named ‘includes’ inside theme folder and create a file name theme-options.php inside it and copy the code from theme-options inside it. This is the where you will write code to add different pages and menu for your option tree panel.
Download Integrated option tree Sample theme from here